public void TenantShouldHaveStorageConfigEquivalentToRoot(string tenantLabel)
        {
            ITenant tenant = this.Tenants[tenantLabel];
            bool propagateRootAsV2 = this.SetupMode is
                SetupModes.ViaApiPropagateRootConfigAsV2 or MultiMode.SetupModes.DirectToStoragePropagateRootConfigAsV2;

            BlobContainerConfiguration v3Config;
            if (propagateRootAsV2)
            {
                tenant.Properties.TryGet("StorageConfiguration__corvustenancy", out LegacyV2BlobStorageConfiguration v2Config)
                    .Should().BeTrue("Failed to read StorageConfiguration__corvustenancy from tenant properties");

                v3Config = LegacyConfigurationConverter.FromV2ToV3(v2Config);
            }
            else
            {
                tenant.Properties.TryGet("StorageConfigurationV3__corvustenancy", out v3Config)
                    .Should().BeTrue("Failed to read StorageConfiguration__corvustenancy from tenant properties");
            }

            v3Config.Should().BeEquivalentTo(this.DiContainer.RootBlobStorageConfiguration);
        }
예제 #2
0
        private static BlobContainerConfiguration V3ConfigurationFromLegacy(
            ITenant tenant,
            string?containerName,
            LegacyV2BlobStorageConfiguration legacyConfiguration)
        {
            BlobContainerConfiguration v3Configuration = LegacyConfigurationConverter.FromV2ToV3(legacyConfiguration);

            if (legacyConfiguration.Container is not null)
            {
                v3Configuration = v3Configuration with
                {
                    Container = string.IsNullOrWhiteSpace(legacyConfiguration.Container)
                        ? containerName is null ? null : AzureStorageBlobContainerNaming.HashAndEncodeBlobContainerName(containerName)
                            : AzureStorageBlobContainerNaming.HashAndEncodeBlobContainerName(
                        legacyConfiguration.DisableTenantIdPrefix
                                ? legacyConfiguration.Container
                                : AzureStorageBlobTenantedContainerNaming.GetTenantedLogicalBlobContainerNameFor(tenant, legacyConfiguration.Container)),
                };
            }

            return(AddContainerNameIfNotInConfig(v3Configuration, containerName));
        }