Skip to content

Commit

Permalink
Disable import/export of config until bug fix (#2273)
Browse files Browse the repository at this point in the history
  • Loading branch information
David R. Williamson authored Jan 10, 2022
1 parent f8b92fc commit 823fbec
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 52 deletions.
51 changes: 25 additions & 26 deletions e2e/test/iothub/service/RegistryManagerExportDevicesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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

Expand All @@ -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
{
Expand Down Expand Up @@ -179,8 +178,8 @@ private async Task<JobProperties> CreateAndWaitForJobAsync(
devicesFileName,
storageAuthenticationType,
identity);
exportJobResponse.IncludeConfigurations = true;
exportJobResponse.ConfigurationsBlobName = configsFileName;
//exportJobResponse.IncludeConfigurations = true;
//exportJobResponse.ConfigurationsBlobName = configsFileName;

while (tryCount < MaxIterationWait)
{
Expand Down Expand Up @@ -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)
{
Expand Down
47 changes: 23 additions & 24 deletions e2e/test/iothub/service/RegistryManagerImportDevicesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<ImportConfiguration>
{
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<ImportConfiguration>
// {
// 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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -201,8 +200,8 @@ private async Task<JobProperties> CreateAndWaitForJobAsync(
devicesFileName,
storageAuthenticationType,
identity);
jobProperties.ConfigurationsBlobName = configsFileName;
jobProperties.IncludeConfigurations = true;
//jobProperties.ConfigurationsBlobName = configsFileName;
//jobProperties.IncludeConfigurations = true;

while (tryCount < MaxIterationWait)
{
Expand Down
4 changes: 2 additions & 2 deletions iothub/service/src/JobProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </remarks>
[JsonProperty(PropertyName = "includeConfigurations", NullValueHandling = NullValueHandling.Ignore)]
public bool? IncludeConfigurations { get; set; }
private bool? IncludeConfigurations { get; set; } // waiting for bug fix before publicizing

/// <summary>
/// Specifies the name of the blob to use when exporting/importing configurations.
Expand All @@ -141,7 +141,7 @@ public JobProperties()
/// The service assumes this is configurations.txt, if not specified.
/// </remarks>
[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

Expand Down

0 comments on commit 823fbec

Please sign in to comment.