Skip to content

Commit 740872b

Browse files
committed
Test workflow
1 parent a0dd296 commit 740872b

File tree

3 files changed

+73
-72
lines changed

3 files changed

+73
-72
lines changed

.github/workflows/base.yml

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
uses: actions/setup-dotnet@v3
5454
with:
5555
dotnet-version: |
56+
8.0.x
5657
9.0.x
5758
- name: Run Tests
5859
shell: bash

test/Kurrent.Client.Tests.Common/Fixtures/KurrentPermanentFixture.cs

+36-36
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ protected KurrentPermanentFixture(ConfigureFixture configure) {
3737

3838
public ILogger Log => Logger;
3939

40-
public ITestService Service { get; }
40+
public ITestService Service { get; }
4141
public KurrentFixtureOptions Options { get; }
42-
public Faker Faker { get; } = new Faker();
42+
public Faker Faker { get; } = new Faker();
4343

44-
public Version EventStoreVersion { get; private set; } = null!;
44+
// public Version EventStoreVersion { get; private set; } = null!;
4545
public bool EventStoreHasLastStreamPosition { get; private set; }
4646

4747
public KurrentClient Streams { get; private set; } = null!;
@@ -87,13 +87,13 @@ public async Task InitializeAsync() {
8787
await ContainerSemaphore.WaitAsync();
8888
try {
8989
await Service.Start();
90+
// EventStoreVersion = GetEventStoreVersion();
91+
// EventStoreHasLastStreamPosition = (EventStoreVersion?.Major ?? int.MaxValue) >= 21;
92+
EventStoreHasLastStreamPosition = true;
9093
} finally {
9194
ContainerSemaphore.Release();
9295
}
9396

94-
EventStoreVersion = GetEventStoreVersion();
95-
EventStoreHasLastStreamPosition = (EventStoreVersion?.Major ?? int.MaxValue) >= 21;
96-
9797
await WarmUpGatekeeper.WaitAsync();
9898

9999
try {
@@ -133,36 +133,36 @@ async Task<T> InitClient<T>(Func<T, Task> action, bool execute = true) where T :
133133
return client;
134134
}
135135

136-
static Version GetEventStoreVersion() {
137-
const string versionPrefix = "EventStoreDB version";
138-
139-
using var cancellator = new CancellationTokenSource(FromSeconds(30));
140-
using var eventstore = new Builder()
141-
.UseContainer()
142-
.UseImage(GlobalEnvironment.DockerImage)
143-
.Command("--version")
144-
.Build()
145-
.Start();
146-
147-
using var log = eventstore.Logs(true, cancellator.Token);
148-
foreach (var line in log.ReadToEnd()) {
149-
if (line.StartsWith(versionPrefix) &&
150-
Version.TryParse(
151-
new string(ReadVersion(line[(versionPrefix.Length + 1)..]).ToArray()),
152-
out var version
153-
)) {
154-
return version;
155-
}
156-
}
157-
158-
throw new InvalidOperationException("Could not determine server version.");
159-
160-
IEnumerable<char> ReadVersion(string s) {
161-
foreach (var c in s.TakeWhile(c => c == '.' || char.IsDigit(c))) {
162-
yield return c;
163-
}
164-
}
165-
}
136+
// static Version GetEventStoreVersion() {
137+
// const string versionPrefix = "EventStoreDB version";
138+
//
139+
// using var cancellator = new CancellationTokenSource(FromSeconds(30));
140+
// using var eventstore = new Builder()
141+
// .UseContainer()
142+
// .UseImage(GlobalEnvironment.DockerImage)
143+
// .Command("--version")
144+
// .Build()
145+
// .Start();
146+
//
147+
// using var log = eventstore.Logs(true, cancellator.Token);
148+
// foreach (var line in log.ReadToEnd()) {
149+
// if (line.StartsWith(versionPrefix) &&
150+
// Version.TryParse(
151+
// new string(ReadVersion(line[(versionPrefix.Length + 1)..]).ToArray()),
152+
// out var version
153+
// )) {
154+
// return version;
155+
// }
156+
// }
157+
//
158+
// throw new InvalidOperationException("Could not determine server version.");
159+
//
160+
// IEnumerable<char> ReadVersion(string s) {
161+
// foreach (var c in s.TakeWhile(c => c == '.' || char.IsDigit(c))) {
162+
// yield return c;
163+
// }
164+
// }
165+
// }
166166
}
167167

168168
public async Task DisposeAsync() {

test/Kurrent.Client.Tests.Common/Fixtures/KurrentTemporaryFixture.cs

+36-36
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ protected KurrentTemporaryFixture(ConfigureFixture configure) {
4040

4141
public ILogger Log => Logger;
4242

43-
public ITestService Service { get; }
43+
public ITestService Service { get; }
4444
public KurrentFixtureOptions Options { get; }
45-
public Faker Faker { get; } = new Faker();
45+
public Faker Faker { get; } = new Faker();
4646

47-
public Version EventStoreVersion { get; private set; } = null!;
47+
// public Version EventStoreVersion { get; private set; } = null!;
4848
public bool EventStoreHasLastStreamPosition { get; private set; }
4949

5050
public KurrentClient Streams { get; private set; } = null!;
@@ -89,13 +89,13 @@ public async Task InitializeAsync() {
8989
await ContainerSemaphore.WaitAsync();
9090
try {
9191
await Service.Start();
92+
// EventStoreVersion = GetEventStoreVersion();
93+
// EventStoreHasLastStreamPosition = (EventStoreVersion?.Major ?? int.MaxValue) >= 21;
94+
EventStoreHasLastStreamPosition = true;
9295
} finally {
9396
ContainerSemaphore.Release();
9497
}
9598

96-
EventStoreVersion = GetEventStoreVersion();
97-
EventStoreHasLastStreamPosition = (EventStoreVersion?.Major ?? int.MaxValue) >= 21;
98-
9999
await WarmUpGatekeeper.WaitAsync();
100100

101101
try {
@@ -135,36 +135,36 @@ async Task<T> InitClient<T>(Func<T, Task> action, bool execute = true) where T :
135135
return client;
136136
}
137137

138-
static Version GetEventStoreVersion() {
139-
const string versionPrefix = "EventStoreDB version";
140-
141-
using var cancellator = new CancellationTokenSource(FromSeconds(30));
142-
using var eventstore = new Builder()
143-
.UseContainer()
144-
.UseImage(GlobalEnvironment.DockerImage)
145-
.Command("--version")
146-
.Build()
147-
.Start();
148-
149-
using var log = eventstore.Logs(true, cancellator.Token);
150-
foreach (var line in log.ReadToEnd()) {
151-
if (line.StartsWith(versionPrefix) &&
152-
Version.TryParse(
153-
new string(ReadVersion(line[(versionPrefix.Length + 1)..]).ToArray()),
154-
out var version
155-
)) {
156-
return version;
157-
}
158-
}
159-
160-
throw new InvalidOperationException("Could not determine server version.");
161-
162-
IEnumerable<char> ReadVersion(string s) {
163-
foreach (var c in s.TakeWhile(c => c == '.' || char.IsDigit(c))) {
164-
yield return c;
165-
}
166-
}
167-
}
138+
// static Version GetEventStoreVersion() {
139+
// const string versionPrefix = "EventStoreDB version";
140+
//
141+
// using var cancellator = new CancellationTokenSource(FromSeconds(30));
142+
// using var eventstore = new Builder()
143+
// .UseContainer()
144+
// .UseImage(GlobalEnvironment.DockerImage)
145+
// .Command("--version")
146+
// .Build()
147+
// .Start();
148+
//
149+
// using var log = eventstore.Logs(true, cancellator.Token);
150+
// foreach (var line in log.ReadToEnd()) {
151+
// if (line.StartsWith(versionPrefix) &&
152+
// Version.TryParse(
153+
// new string(ReadVersion(line[(versionPrefix.Length + 1)..]).ToArray()),
154+
// out var version
155+
// )) {
156+
// return version;
157+
// }
158+
// }
159+
//
160+
// throw new InvalidOperationException("Could not determine server version.");
161+
//
162+
// IEnumerable<char> ReadVersion(string s) {
163+
// foreach (var c in s.TakeWhile(c => c == '.' || char.IsDigit(c))) {
164+
// yield return c;
165+
// }
166+
// }
167+
// }
168168
}
169169

170170
public async Task DisposeAsync() {

0 commit comments

Comments
 (0)