mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 21:54:33 +02:00
Merge branch 'fix/mqtt_test_app' into 'master'
mqtt_test_app: Fix the error code values in mqtt test app See merge request espressif/esp-idf!15289
This commit is contained in:
@@ -267,7 +267,7 @@ def connection_tests(dut, cases):
|
|||||||
with TlsServer(server_port, client_cert=True) as s:
|
with TlsServer(server_port, client_cert=True) as s:
|
||||||
test_nr = start_connection_case(case, 'server with client verification - handshake error since client presents no client certificate')
|
test_nr = start_connection_case(case, 'server with client verification - handshake error since client presents no client certificate')
|
||||||
dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30)
|
dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30)
|
||||||
dut.expect('ESP-TLS ERROR: 0x8010') # expect ... handshake error (PEER_DID_NOT_RETURN_A_CERTIFICATE)
|
dut.expect('ESP-TLS ERROR: ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED') # expect ... handshake error (PEER_DID_NOT_RETURN_A_CERTIFICATE)
|
||||||
if 'PEER_DID_NOT_RETURN_A_CERTIFICATE' not in s.get_last_ssl_error():
|
if 'PEER_DID_NOT_RETURN_A_CERTIFICATE' not in s.get_last_ssl_error():
|
||||||
raise('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error()))
|
raise('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error()))
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ def connection_tests(dut, cases):
|
|||||||
with TlsServer(server_port) as s:
|
with TlsServer(server_port) as s:
|
||||||
test_nr = start_connection_case(case, 'invalid server certificate on default server - expect ssl handshake error')
|
test_nr = start_connection_case(case, 'invalid server certificate on default server - expect ssl handshake error')
|
||||||
dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30)
|
dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30)
|
||||||
dut.expect('ESP-TLS ERROR: 0x8010') # expect ... handshake error (TLSV1_ALERT_UNKNOWN_CA)
|
dut.expect('ESP-TLS ERROR: ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED') # expect ... handshake error (TLSV1_ALERT_UNKNOWN_CA)
|
||||||
if 'alert unknown ca' not in s.get_last_ssl_error():
|
if 'alert unknown ca' not in s.get_last_ssl_error():
|
||||||
raise Exception('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error()))
|
raise Exception('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error()))
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ def connection_tests(dut, cases):
|
|||||||
with TlsServer(server_port, client_cert=True) as s:
|
with TlsServer(server_port, client_cert=True) as s:
|
||||||
test_nr = start_connection_case(case, 'Invalid client certificate on server with client verification - expect ssl handshake error')
|
test_nr = start_connection_case(case, 'Invalid client certificate on server with client verification - expect ssl handshake error')
|
||||||
dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30)
|
dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30)
|
||||||
dut.expect('ESP-TLS ERROR: 0x8010') # expect ... handshake error (CERTIFICATE_VERIFY_FAILED)
|
dut.expect('ESP-TLS ERROR: ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED') # expect ... handshake error (CERTIFICATE_VERIFY_FAILED)
|
||||||
if 'CERTIFICATE_VERIFY_FAILED' not in s.get_last_ssl_error():
|
if 'CERTIFICATE_VERIFY_FAILED' not in s.get_last_ssl_error():
|
||||||
raise Exception('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error()))
|
raise Exception('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error()))
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
|||||||
case MQTT_EVENT_ERROR:
|
case MQTT_EVENT_ERROR:
|
||||||
ESP_LOGI(TAG, "MQTT_EVENT_ERROR: Test=%d", running_test_case);
|
ESP_LOGI(TAG, "MQTT_EVENT_ERROR: Test=%d", running_test_case);
|
||||||
if (event->error_handle->error_type == MQTT_ERROR_TYPE_ESP_TLS) {
|
if (event->error_handle->error_type == MQTT_ERROR_TYPE_ESP_TLS) {
|
||||||
ESP_LOGI(TAG, "ESP-TLS ERROR: 0x%x", event->error_handle->esp_tls_last_esp_err);
|
ESP_LOGI(TAG, "ESP-TLS ERROR: %s", esp_err_to_name(event->error_handle->esp_tls_last_esp_err));
|
||||||
} else if (event->error_handle->error_type == MQTT_ERROR_TYPE_CONNECTION_REFUSED) {
|
} else if (event->error_handle->error_type == MQTT_ERROR_TYPE_CONNECTION_REFUSED) {
|
||||||
ESP_LOGI(TAG, "MQTT ERROR: 0x%x", event->error_handle->connect_return_code);
|
ESP_LOGI(TAG, "MQTT ERROR: 0x%x", event->error_handle->connect_return_code);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user