Skip to content

Commit

Permalink
test: try fix docker integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Aug 28, 2024
1 parent 3f15003 commit 6000d95
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
- name: Test
shell: bash
run: dotnet test --nologo --no-build --filter 'FullyQualifiedName~IntegrationTests' StreetNameRegistry.sln
run: |
ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose
dotnet test --nologo --no-build --filter 'FullyQualifiedName~IntegrationTests' StreetNameRegistry.sln
env:
OAuth2IntrospectionOptions__ClientId: ${{ secrets.VBR_ACMIDM_INTROSPECTION_CLIENT_ID_TST }}
OAuth2IntrospectionOptions__ClientSecret: ${{ secrets.VBR_ACMIDM_INTROSPECTION_CLIENT_SECRET_TST }}
Expand Down
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ nuget Moq 4.20.70
nuget AutoFixture.Xunit2 4.18.1
nuget Serilog.Sinks.XUnit 3.0.5

nuget Be.Vlaanderen.Basisregisters.DockerUtilities 2.0.0
nuget Be.Vlaanderen.Basisregisters.DockerUtilities 3.0.0

// BUILD STUFF
nuget SourceLink.Embed.AllSourceFiles 2.8.3 copy_local: true
Expand Down
2 changes: 1 addition & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ NUGET
GeoJSON.Net (>= 1.2.19)
Microsoft.Extensions.Logging.Abstractions (>= 8.0)
NodaTime (>= 3.1.11)
Be.Vlaanderen.Basisregisters.DockerUtilities (2.0)
Be.Vlaanderen.Basisregisters.DockerUtilities (3.0)
Ductus.FluentDocker (>= 2.10.59)
Be.Vlaanderen.Basisregisters.EventHandling (5.0)
Be.Vlaanderen.Basisregisters.Converters.TrimString (>= 4.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ namespace StreetNameRegistry.Api.BackOffice.IntegrationTests
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Be.Vlaanderen.Basisregisters.DockerUtilities;
using Ductus.FluentDocker.Builders;
using Ductus.FluentDocker.Model.Compose;
using Ductus.FluentDocker.Services;
//using Be.Vlaanderen.Basisregisters.DockerUtilities;
using IdentityModel;
using IdentityModel.Client;
using Infrastructure;
Expand Down Expand Up @@ -52,6 +55,21 @@ public async Task<string> GetAccessToken(string requiredScopes = "")
return _accessTokens[requiredScopes].Token;
}

public static ICompositeService Compose(
string dockerComposeFilePath,
string serviceName)
{
return new Builder()
.UseContainer()
.UseCompose()
.AssumeComposeVersion(ComposeVersion.V2)
.ServiceName(serviceName)
.FromFile(dockerComposeFilePath)
.RemoveOrphans()
.Build()
.Start();
}

public async Task InitializeAsync()
{
var configuration = new ConfigurationBuilder()
Expand All @@ -64,7 +82,7 @@ public async Task InitializeAsync()
_clientId = configuration.GetValue<string>("ClientId");
_clientSecret = configuration.GetValue<string>("ClientSecret");

using var _ = DockerComposer.Compose("sqlserver.yml", "streetname-integration-tests");
using var _ = Compose("sqlserver.yml", "streetname-integration-tests");
await WaitForSqlServerToBecomeAvailable();

await CreateDatabase();
Expand Down

0 comments on commit 6000d95

Please sign in to comment.