From ec9441e027744c47ac40643aa39a9401b830385a Mon Sep 17 00:00:00 2001 From: "David R. Williamson" <14119884+drwill-ms@users.noreply.github.com> Date: Mon, 17 Apr 2023 17:29:49 -0700 Subject: [PATCH] Update MQTT and AMQP minor package versions (#3278) * Update MQTT and AMQP minor package versions * Change in behavior of MQTT lib --- e2e/Tests/helpers/templates/FaultInjection.cs | 9 ++------- .../device/src/Exceptions/IotHubClientErrorCode.cs | 12 ------------ .../device/src/Microsoft.Azure.Devices.Client.csproj | 4 ++-- iothub/device/src/Pipeline/MqttTransportHandler.cs | 4 ++-- iothub/service/src/Microsoft.Azure.Devices.csproj | 2 +- ...icrosoft.Azure.Devices.Provisioning.Client.csproj | 4 ++-- 6 files changed, 9 insertions(+), 26 deletions(-) diff --git a/e2e/Tests/helpers/templates/FaultInjection.cs b/e2e/Tests/helpers/templates/FaultInjection.cs index cb4c0bf8bf..b6315ccbfe 100644 --- a/e2e/Tests/helpers/templates/FaultInjection.cs +++ b/e2e/Tests/helpers/templates/FaultInjection.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using FluentAssertions; using Microsoft.Azure.Devices.Client; +using MQTTnet.Client; // If you see intermittent failures on devices that are created by this file, check to see if you have multiple suites // running at the same time because one test run could be accidentally destroying devices created by a different test run. @@ -78,15 +79,9 @@ internal static async Task ActivateFaultInjectionAsync( await deviceClient.SendTelemetryAsync(faultInjectionMessage, linkedCts.Token).ConfigureAwait(false); } - catch (IotHubClientException ex) when (ex.IsTransient || ex.ErrorCode == IotHubClientErrorCode.ConnectionForcefullyClosedOnFaultInjection) + catch (IotHubClientException ex) when (ex.IsTransient || ex.InnerException is MqttClientDisconnectedException) { VerboseTestLogger.WriteLine($"{nameof(ActivateFaultInjectionAsync)}: {ex}"); - - // For quota injection, the fault is only seen for the original HTTP request. - if (transportSettings is IotHubClientHttpSettings) - { - throw; - } } catch (OperationCanceledException ex) when (transportSettings is IotHubClientMqttSettings) { diff --git a/iothub/device/src/Exceptions/IotHubClientErrorCode.cs b/iothub/device/src/Exceptions/IotHubClientErrorCode.cs index a5c0fde025..1292dc540b 100644 --- a/iothub/device/src/Exceptions/IotHubClientErrorCode.cs +++ b/iothub/device/src/Exceptions/IotHubClientErrorCode.cs @@ -153,17 +153,5 @@ public enum IotHubClientErrorCode /// is invalid. /// IotHubFormatError = 400006, - - /// - /// Used for fault injection, end-to-end testing in the SDK only. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - ConnectionForcefullyClosedOnFaultInjection = 400029, - - /// - /// Used for fault injection, end-to-end testing in the SDK only. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - ConnectionRejectedOnFaultInjection = 400030, } } diff --git a/iothub/device/src/Microsoft.Azure.Devices.Client.csproj b/iothub/device/src/Microsoft.Azure.Devices.Client.csproj index cddfd0522f..1ca25f1d72 100644 --- a/iothub/device/src/Microsoft.Azure.Devices.Client.csproj +++ b/iothub/device/src/Microsoft.Azure.Devices.Client.csproj @@ -58,8 +58,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/iothub/device/src/Pipeline/MqttTransportHandler.cs b/iothub/device/src/Pipeline/MqttTransportHandler.cs index 3683833743..513f4bfc5c 100644 --- a/iothub/device/src/Pipeline/MqttTransportHandler.cs +++ b/iothub/device/src/Pipeline/MqttTransportHandler.cs @@ -439,9 +439,9 @@ public override async Task SendTelemetryAsync(TelemetryMessage message, Cancella if (message.Properties.ContainsKey("AzIoTHub_FaultOperationType")) { - // When fualt injection causes this operation to fail, the MQTT layer throws a TaskCanceledException. + // When fault injection causes this operation to fail, the MQTT layer throws a MqttClientDisconnectedException. // Normally, we don't want that to get to the device app, but for fault injection tests we prefer - // an exception that is not retryable so we'll let this exception slip through. + // an exception that is NOT retryable so we'll let this exception slip through. throw; } diff --git a/iothub/service/src/Microsoft.Azure.Devices.csproj b/iothub/service/src/Microsoft.Azure.Devices.csproj index d5af0bd00c..a8790a623b 100644 --- a/iothub/service/src/Microsoft.Azure.Devices.csproj +++ b/iothub/service/src/Microsoft.Azure.Devices.csproj @@ -69,6 +69,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/provisioning/device/src/Microsoft.Azure.Devices.Provisioning.Client.csproj b/provisioning/device/src/Microsoft.Azure.Devices.Provisioning.Client.csproj index b6c130f3e7..fa5e8575a6 100644 --- a/provisioning/device/src/Microsoft.Azure.Devices.Provisioning.Client.csproj +++ b/provisioning/device/src/Microsoft.Azure.Devices.Provisioning.Client.csproj @@ -62,8 +62,8 @@ - - + + all