Skip to content

Commit

Permalink
React to new Microsoft.Health.Blob changes to heathcheck APIs (#875)
Browse files Browse the repository at this point in the history
* React to new Microsoft.Health.Blob changes to heathcheck APIs

* SQL changes pulled

* Disable Admin consent because it is not working again
  • Loading branch information
smithago authored Jul 10, 2021
1 parent de3ad4b commit 45892b5
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<HealthcareSharedPackageVersion>2.1.40</HealthcareSharedPackageVersion>
<HealthcareSharedPackageVersion>3.0.13</HealthcareSharedPackageVersion>
<HighEntropyVA>true</HighEntropyVA>
<LangVersion>Latest</LangVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function Add-AadTestAuthEnvironment {
$secretSecureString = ConvertTo-SecureString $newPassword.Value -AsPlainText -Force
}

Grant-ClientAppAdminConsent -AppId $aadClientApplication.AppId -TenantAdminCredential $TenantAdminCredential
# Grant-ClientAppAdminConsent -AppId $aadClientApplication.AppId -TenantAdminCredential $TenantAdminCredential

$environmentClientApplications += @{
id = $clientApp.Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ public class DicomBlobHealthCheck : BlobHealthCheck
/// Initializes a new instance of the <see cref="DicomBlobHealthCheck"/> class.
/// </summary>
/// <param name="client">The blob client factory.</param>
/// <param name="configuration">The blob data store configuration.</param>
/// <param name="namedBlobContainerConfigurationAccessor">The IOptions accessor to get a named blob container version.</param>
/// <param name="testProvider">The test provider.</param>
/// <param name="logger">The logger.</param>
public DicomBlobHealthCheck(
BlobServiceClient client,
BlobDataStoreConfiguration configuration,
IOptionsSnapshot<BlobContainerConfiguration> namedBlobContainerConfigurationAccessor,
IBlobClientTestProvider testProvider,
ILogger<DicomBlobHealthCheck> logger)
: base(
client,
configuration,
namedBlobContainerConfigurationAccessor,
Constants.ContainerConfigurationName,
testProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ public class MetadataHealthCheck : BlobHealthCheck
/// Initializes a new instance of the <see cref="MetadataHealthCheck"/> class.
/// </summary>
/// <param name="client">The blob client factory.</param>
/// <param name="configuration">The blob data store configuration.</param>
/// <param name="namedBlobContainerConfigurationAccessor">The IOptions accessor to get a named blob container version.</param>
/// <param name="testProvider">The test provider.</param>
/// <param name="logger">The logger.</param>
public MetadataHealthCheck(
BlobServiceClient client,
BlobDataStoreConfiguration configuration,
IOptionsSnapshot<BlobContainerConfiguration> namedBlobContainerConfigurationAccessor,
IBlobClientTestProvider testProvider,
ILogger<MetadataHealthCheck> logger)
: base(
client,
configuration,
namedBlobContainerConfigurationAccessor,
Constants.ContainerConfigurationName,
testProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ public static IDicomServerBuilder AddSqlServer(
EnsureArg.IsNotNull(dicomServerBuilder, nameof(dicomServerBuilder));
IServiceCollection services = dicomServerBuilder.Services;

services.AddSqlServerBase<SchemaVersion>(configurationRoot);
services
.AddSqlServerConnection(
config =>
{
configurationRoot?.GetSection(SqlServerDataStoreConfiguration.SectionName).Bind(config);
configureAction?.Invoke(config);
})
.AddSqlServerManagement<SchemaVersion>();

services.AddSqlServerApi();

var config = new SqlServerDataStoreConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ public async Task InitializeAsync()

IBlobClientTestProvider testProvider = new BlobClientReadWriteTestProvider(RecyclableMemoryStreamManager);

var blobClientInitializer = new BlobClientInitializer(testProvider, NullLogger<BlobClientInitializer>.Instance);
_blobClient = blobClientInitializer.CreateBlobClient(_blobDataStoreConfiguration);
_blobClient = BlobClientFactory.Create(_blobDataStoreConfiguration);

var blobClientInitializer = new BlobInitializer(_blobClient, testProvider, NullLogger<BlobInitializer>.Instance);

var blobContainerInitializer = new BlobContainerInitializer(_blobContainerConfiguration.ContainerName, NullLogger<BlobContainerInitializer>.Instance);
var metadataContainerInitializer = new BlobContainerInitializer(_metadataContainerConfiguration.ContainerName, NullLogger<BlobContainerInitializer>.Instance);

await blobClientInitializer.InitializeDataStoreAsync(
_blobClient,
_blobDataStoreConfiguration,
new List<IBlobContainerInitializer> { blobContainerInitializer, metadataContainerInitializer });

var jsonSerializer = new JsonSerializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using MediatR;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Microsoft.Health.Dicom.Core.Features.ExtendedQueryTag;
using Microsoft.Health.Dicom.Core.Features.Retrieve;
using Microsoft.Health.Dicom.Core.Features.Store;
Expand Down Expand Up @@ -56,13 +57,15 @@ internal SqlDataStoreTestsFixture(string databaseName)
},
};

IOptions<SqlServerDataStoreConfiguration> configOptions = Options.Create(config);

var scriptProvider = new ScriptProvider<SchemaVersion>();

var baseScriptProvider = new BaseScriptProvider();

var mediator = Substitute.For<IMediator>();

var sqlConnectionStringProvider = new DefaultSqlConnectionStringProvider(config);
var sqlConnectionStringProvider = new DefaultSqlConnectionStringProvider(configOptions);

var sqlConnectionFactory = new DefaultSqlConnectionFactory(sqlConnectionStringProvider);

Expand All @@ -72,7 +75,7 @@ internal SqlDataStoreTestsFixture(string databaseName)

SchemaInformation = new SchemaInformation(SchemaVersionConstants.Min, SchemaVersionConstants.Max);

_schemaInitializer = new SchemaInitializer(config, SchemaUpgradeRunner, SchemaInformation, sqlConnectionFactory, sqlConnectionStringProvider, mediator, NullLogger<SchemaInitializer>.Instance);
_schemaInitializer = new SchemaInitializer(configOptions, schemaManagerDataStore, SchemaUpgradeRunner, SchemaInformation, sqlConnectionFactory, sqlConnectionStringProvider, mediator, NullLogger<SchemaInitializer>.Instance);

SqlTransactionHandler = new SqlTransactionHandler();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public AuthorizationTests(HttpIntegrationTestFixture<Startup> fixture)
_fixture = fixture;
}

[Fact]
[Fact(Skip = "Setup AAD admin consent issue, Bug 83049: DICOM OSS CI is broken")]
public async Task GivenPostDicomRequest_WithAReadOnlyToken_ReturnUnauthorized()
{
if (AuthenticationSettings.SecurityEnabled)
Expand Down

0 comments on commit 45892b5

Please sign in to comment.