From 823fbec28ff4069b237895303322af9cc8243f2f Mon Sep 17 00:00:00 2001 From: "David R. Williamson" Date: Mon, 10 Jan 2022 13:01:53 -0800 Subject: [PATCH] Disable import/export of config until bug fix (#2273) --- .../RegistryManagerExportDevicesTests.cs | 51 +++++++++---------- .../RegistryManagerImportDevicesTests.cs | 47 +++++++++-------- iothub/service/src/JobProperties.cs | 4 +- 3 files changed, 50 insertions(+), 52 deletions(-) diff --git a/e2e/test/iothub/service/RegistryManagerExportDevicesTests.cs b/e2e/test/iothub/service/RegistryManagerExportDevicesTests.cs index e2729e5fb1..de45b2783c 100644 --- a/e2e/test/iothub/service/RegistryManagerExportDevicesTests.cs +++ b/e2e/test/iothub/service/RegistryManagerExportDevicesTests.cs @@ -66,7 +66,6 @@ public async Task RegistryManager_ExportDevices(StorageAuthenticationType storag using RegistryManager registryManager = RegistryManager.CreateFromConnectionString(TestConfiguration.IoTHub.ConnectionString); - try { string containerName = StorageContainer.BuildContainerName(idPrefix); @@ -107,23 +106,23 @@ public async Task RegistryManager_ExportDevices(StorageAuthenticationType storag }) .ConfigureAwait(false); - Configuration configuration = await registryManager - .AddConfigurationAsync( - new Configuration(configurationId) - { - Priority = 2, - Labels = { { "labelName", "labelValue" } }, - TargetCondition = "*", - Content = - { - DeviceContent = { { "properties.desired.x", 4L } }, - }, - Metrics = - { - Queries = { { "successfullyConfigured", "select deviceId from devices where properties.reported.x = 4" } } - }, - }) - .ConfigureAwait(false); + //Configuration configuration = await registryManager + // .AddConfigurationAsync( + // new Configuration(configurationId) + // { + // Priority = 2, + // Labels = { { "labelName", "labelValue" } }, + // TargetCondition = "*", + // Content = + // { + // DeviceContent = { { "properties.desired.x", 4L } }, + // }, + // Metrics = + // { + // Queries = { { "successfullyConfigured", "select deviceId from devices where properties.reported.x = 4" } } + // }, + // }) + // .ConfigureAwait(false); // act @@ -144,11 +143,11 @@ await ValidateDevicesAsync( edge2, device) .ConfigureAwait(false); - await ValidateConfigurationsAsync( - configsFileName, - storageContainer, - configuration) - .ConfigureAwait(false); + //await ValidateConfigurationsAsync( + // configsFileName, + // storageContainer, + // configuration) + // .ConfigureAwait(false); } finally { @@ -179,8 +178,8 @@ private async Task CreateAndWaitForJobAsync( devicesFileName, storageAuthenticationType, identity); - exportJobResponse.IncludeConfigurations = true; - exportJobResponse.ConfigurationsBlobName = configsFileName; + //exportJobResponse.IncludeConfigurations = true; + //exportJobResponse.ConfigurationsBlobName = configsFileName; while (tryCount < MaxIterationWait) { @@ -316,7 +315,7 @@ private async Task CleanUpDevicesAsync( await registryManager.RemoveDeviceAsync(deviceId).ConfigureAwait(false); await registryManager.RemoveDeviceAsync(edgeId2).ConfigureAwait(false); await registryManager.RemoveDeviceAsync(edgeId1).ConfigureAwait(false); - await registryManager.RemoveConfigurationAsync(configurationId).ConfigureAwait(false); + //await registryManager.RemoveConfigurationAsync(configurationId).ConfigureAwait(false); } catch (Exception ex) { diff --git a/e2e/test/iothub/service/RegistryManagerImportDevicesTests.cs b/e2e/test/iothub/service/RegistryManagerImportDevicesTests.cs index 4a7f0ba1e6..6ca80fe991 100644 --- a/e2e/test/iothub/service/RegistryManagerImportDevicesTests.cs +++ b/e2e/test/iothub/service/RegistryManagerImportDevicesTests.cs @@ -43,7 +43,6 @@ public class RegistryManagerImportDevicesTests : E2EMsTestBase [DataRow(StorageAuthenticationType.KeyBased, false)] [DataRow(StorageAuthenticationType.IdentityBased, false)] [DataRow(StorageAuthenticationType.IdentityBased, true)] - [Ignore("Waiting on IcM 279379774 to be resolved, estimated early Jan 2022")] public async Task RegistryManager_ImportDevices(StorageAuthenticationType storageAuthenticationType, bool isUserAssignedMsi) { // arrange @@ -81,26 +80,26 @@ public async Task RegistryManager_ImportDevices(StorageAuthenticationType storag }); await UploadFileAndConfirmAsync(storageContainer, devicesStream, devicesFileName).ConfigureAwait(false); - using Stream configsStream = ImportExportHelpers.BuildImportStream( - new List - { - new ImportConfiguration(configId) - { - ImportMode = ConfigurationImportMode.CreateOrUpdateIfMatchETag, - Priority = 3, - Labels = { { "labelName", "labelValue" } }, - TargetCondition = "*", - Content = - { - DeviceContent = { { "properties.desired.x", 5L } }, - }, - Metrics = - { - Queries = { { "successfullyConfigured", "select deviceId from devices where properties.reported.x = 5" } } - }, - }, - }); - await UploadFileAndConfirmAsync(storageContainer, configsStream, configsFileName).ConfigureAwait(false); + //using Stream configsStream = ImportExportHelpers.BuildImportStream( + // new List + // { + // new ImportConfiguration(configId) + // { + // ImportMode = ConfigurationImportMode.CreateOrUpdateIfMatchETag, + // Priority = 3, + // Labels = { { "labelName", "labelValue" } }, + // TargetCondition = "*", + // Content = + // { + // DeviceContent = { { "properties.desired.x", 5L } }, + // }, + // Metrics = + // { + // Queries = { { "successfullyConfigured", "select deviceId from devices where properties.reported.x = 5" } } + // }, + // }, + // }); + //await UploadFileAndConfirmAsync(storageContainer, configsStream, configsFileName).ConfigureAwait(false); ManagedIdentity identity = isUserAssignedMsi ? new ManagedIdentity @@ -134,7 +133,7 @@ public async Task RegistryManager_ImportDevices(StorageAuthenticationType storag try { device = await registryManager.GetDeviceAsync(deviceId).ConfigureAwait(false); - config = await registryManager.GetConfigurationAsync(configId).ConfigureAwait(false); + //config = await registryManager.GetConfigurationAsync(configId).ConfigureAwait(false); break; } catch (Exception ex) @@ -201,8 +200,8 @@ private async Task CreateAndWaitForJobAsync( devicesFileName, storageAuthenticationType, identity); - jobProperties.ConfigurationsBlobName = configsFileName; - jobProperties.IncludeConfigurations = true; + //jobProperties.ConfigurationsBlobName = configsFileName; + //jobProperties.IncludeConfigurations = true; while (tryCount < MaxIterationWait) { diff --git a/iothub/service/src/JobProperties.cs b/iothub/service/src/JobProperties.cs index b3cd816cb8..e708e8d5e2 100644 --- a/iothub/service/src/JobProperties.cs +++ b/iothub/service/src/JobProperties.cs @@ -132,7 +132,7 @@ public JobProperties() /// The service assumes this is false, if not specified. If true, then configurations are included in the data export/import. /// [JsonProperty(PropertyName = "includeConfigurations", NullValueHandling = NullValueHandling.Ignore)] - public bool? IncludeConfigurations { get; set; } + private bool? IncludeConfigurations { get; set; } // waiting for bug fix before publicizing /// /// Specifies the name of the blob to use when exporting/importing configurations. @@ -141,7 +141,7 @@ public JobProperties() /// The service assumes this is configurations.txt, if not specified. /// [JsonProperty(PropertyName = "configurationsBlobName", NullValueHandling = NullValueHandling.Ignore)] - public string ConfigurationsBlobName { get; set; } + private string ConfigurationsBlobName { get; set; } // waiting for bug fix before publicizing #pragma warning disable CA1054 // Uri parameters should not be strings