Skip to content

Commit

Permalink
Remove unused target frameworks and pass certificate in healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
w1am committed Dec 20, 2024
1 parent 2cdf1f0 commit 107e4a5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 41 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
framework: [ net6.0, net7.0, net8.0 ]
framework: [ net8.0 ]
os: [ ubuntu-latest ]
configuration: [ release ]
runs-on: ${{ matrix.os }}
Expand All @@ -52,8 +52,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Run Tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
framework: [ net6.0, net7.0, net8.0 ]
framework: [ net8.0 ]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
name: scan-vulnerabilities/${{ matrix.os }}/${{ matrix.framework }}
Expand Down
8 changes: 0 additions & 8 deletions samples/Samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "quick-start", "quick-start\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client", "client", "{EBB93BBC-42A7-48E4-B1EA-0EA3953D347C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client.Streams", "..\src\EventStore.Client.Streams\EventStore.Client.Streams.csproj", "{A32CE3CB-AB71-45C6-A1B2-CD94BE2D2B28}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client", "..\src\EventStore.Client\EventStore.Client.csproj", "{A71A13F7-8480-4E48-B88D-A2364F7C95B6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "connecting-to-a-cluster", "connecting-to-a-cluster\connecting-to-a-cluster.csproj", "{C4CA324A-450D-4621-82F1-B4ECD18216B6}"
Expand All @@ -29,12 +27,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "server-side-filtering", "se
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "persistent-subscriptions", "persistent-subscriptions\persistent-subscriptions.csproj", "{A5A5EF0D-1AE4-4647-823D-FA172E8858F2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client.PersistentSubscriptions", "..\src\EventStore.Client.PersistentSubscriptions\EventStore.Client.PersistentSubscriptions.csproj", "{7200BB01-A405-45D5-A6E8-A8FA8DE39DA0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventStore.Client.ProjectionManagement", "..\src\EventStore.Client.ProjectionManagement\EventStore.Client.ProjectionManagement.csproj", "{79992D7B-C311-4E8A-856F-896C1EA61042}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "projection-management", "projection-management\projection-management.csproj", "{9DEA2684-C38B-465C-91A6-ED2AB67A4338}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "diagnostics", "diagnostics\diagnostics.csproj", "{546496AD-E355-4C20-930C-30D0FC76D26F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "user-certificates", "user-certificates\user-certificates.csproj", "{28112410-D02D-427A-9D36-3FE3A6DC6B0D}"
Expand Down
58 changes: 29 additions & 29 deletions test/EventStore.Client.Tests.Common/Fixtures/EventStoreTestNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,40 +81,40 @@ protected override ContainerBuilder Configure() {
.WithEnvironment(env)
.MountVolume(certsPath, "/etc/eventstore/certs", MountType.ReadOnly)
.ExposePort(port, 2113)
//.KeepContainer().KeepRunning().ReuseIfExists()
// .KeepContainer().KeepRunning().ReuseIfExists()
.WaitUntilReadyWithConstantBackoff(1_000, 60, service => {
var output = service.ExecuteCommand("curl -o - -I http://admin:changeit@localhost:2113/health/live");
var output = service.ExecuteCommand("curl -u admin:changeit --cacert /etc/eventstore/certs/ca/ca.crt https://localhost:2113/health/live");
if (!output.Success)
throw new Exception(output.Error);
});
}

/// <summary>
/// max of 30 seconds (300 * 100ms)
/// </summary>
static readonly IEnumerable<TimeSpan> DefaultBackoffDelay = Backoff.ConstantBackoff(FromMilliseconds(100), 300);

protected override async Task OnServiceStarted() {
using var http = new HttpClient(
#if NET
new SocketsHttpHandler { SslOptions = { RemoteCertificateValidationCallback = delegate { return true; } } }
#else
new WinHttpHandler { ServerCertificateValidationCallback = delegate { return true; } }
#endif
) {
BaseAddress = Options.ClientSettings.ConnectivitySettings.Address
};

await Policy.Handle<Exception>()
.WaitAndRetryAsync(DefaultBackoffDelay)
.ExecuteAsync(
async () => {
using var response = await http.GetAsync("/health/live", CancellationToken.None);
if (response.StatusCode >= HttpStatusCode.BadRequest)
throw new FluentDockerException($"Health check failed with status code: {response.StatusCode}.");
}
);
}
// /// <summary>
// /// max of 30 seconds (300 * 100ms)
// /// </summary>
// static readonly IEnumerable<TimeSpan> DefaultBackoffDelay = Backoff.ConstantBackoff(FromMilliseconds(100), 300);
//
// protected override async Task OnServiceStarted() {
// using var http = new HttpClient(
// #if NET
// new SocketsHttpHandler { SslOptions = { RemoteCertificateValidationCallback = delegate { return true; } } }
// #else
// new WinHttpHandler { ServerCertificateValidationCallback = delegate { return true; } }
// #endif
// ) {
// BaseAddress = Options.ClientSettings.ConnectivitySettings.Address
// };
//
// await Policy.Handle<Exception>()
// .WaitAndRetryAsync(DefaultBackoffDelay)
// .ExecuteAsync(
// async () => {
// using var response = await http.GetAsync("/health/live", CancellationToken.None);
// if (response.StatusCode >= HttpStatusCode.BadRequest)
// throw new FluentDockerException($"Health check failed with status code: {response.StatusCode}.");
// }
// );
// }
}

/// <summary>
Expand Down Expand Up @@ -164,4 +164,4 @@ public async Task<int> GetNextAvailablePort(TimeSpan delay = default) {
}

public int NextAvailablePort => GetNextAvailablePort(FromMilliseconds(100)).GetAwaiter().GetResult();
}
}

0 comments on commit 107e4a5

Please sign in to comment.