Skip to content

Commit 0c88855

Browse files
authored
fix(cd): Add WSL setup and fix LOLWUT assertions for CD pipeline (#334)
Signed-off-by: currantw <taylor.curran@improving.com>
1 parent 8b468d2 commit 0c88855

2 files changed

Lines changed: 23 additions & 33 deletions

File tree

.github/workflows/cd.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,16 @@ jobs:
263263
dotnet add tests/Valkey.Glide.IntegrationTests package Valkey.Glide --version $RELEASE_VERSION
264264
git diff
265265
266+
- name: Setup WSL (Windows only)
267+
# WSL2 is not available on windows-11-arm runners (no Hyper-V).
268+
if: ${{ matrix.host.OS == 'windows' && matrix.host.ARCH != 'arm64' }}
269+
uses: Vampire/setup-wsl@v7
270+
with:
271+
distribution: Ubuntu-22.04
272+
additional-packages: build-essential git make pkg-config libssl-dev
273+
266274
- name: Install server
267-
# WSL2 is not available on windows-11-arm runners (no Hyper-V), so we cannot run Valkey server there.
275+
# WSL2 is not available on windows-11-arm runners (no Hyper-V).
268276
if: ${{ !(matrix.host.OS == 'windows' && matrix.host.ARCH == 'arm64') }}
269277
uses: ./.github/workflows/install-server
270278
with:

tests/Valkey.Glide.IntegrationTests/ServerManagementCommandTests.cs

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Valkey.Glide.IntegrationTests;
1010
/// </summary>
1111
[Collection(typeof(ServerManagementCommandTests))]
1212
[CollectionDefinition(DisableParallelization = true)]
13-
public class ServerManagementCommandTests(ServerManagementFixture fixture) : IClassFixture<ServerManagementFixture>
13+
public class ServerManagementCommandTests(ServerManagementCommandFixture fixture) : IClassFixture<ServerManagementCommandFixture>
1414
{
1515
private GlideClient StandaloneClient => fixture.StandaloneClient!;
1616
private GlideClusterClient ClusterClient => fixture.ClusterClient!;
@@ -132,51 +132,27 @@ public async Task FlushDatabaseAsync_Cluster_WithSyncMode_AndRoute()
132132

133133
[Fact]
134134
public async Task LolwutAsync_Standalone_WithVersion()
135-
{
136-
string result = await StandaloneClient.LolwutAsync(new LolwutOptions { Version = 5 });
137-
Assert.NotEmpty(result);
138-
Assert.Contains("Valkey", result, StringComparison.OrdinalIgnoreCase);
139-
}
135+
=> AssertContainsServerName(await StandaloneClient.LolwutAsync(new LolwutOptions { Version = 5 }));
140136

141137
[Fact]
142138
public async Task LolwutAsync_Standalone_WithVersionAndParameters()
143-
{
144-
string result = await StandaloneClient.LolwutAsync(new LolwutOptions { Version = 5, Parameters = [40, 20] });
145-
Assert.NotEmpty(result);
146-
Assert.Contains("Valkey", result, StringComparison.OrdinalIgnoreCase);
147-
}
139+
=> AssertContainsServerName(await StandaloneClient.LolwutAsync(new LolwutOptions { Version = 5, Parameters = [40, 20] }));
148140

149141
[Fact]
150142
public async Task LolwutAsync_Cluster_WithVersion()
151-
{
152-
string result = await ClusterClient.LolwutAsync(new LolwutOptions { Version = 5 });
153-
Assert.NotEmpty(result);
154-
Assert.Contains("Valkey", result, StringComparison.OrdinalIgnoreCase);
155-
}
143+
=> AssertContainsServerName(await ClusterClient.LolwutAsync(new LolwutOptions { Version = 5 }));
156144

157145
[Fact]
158146
public async Task LolwutAsync_Cluster_WithVersionAndParameters()
159-
{
160-
string result = await ClusterClient.LolwutAsync(new LolwutOptions { Version = 5, Parameters = [40, 20] });
161-
Assert.NotEmpty(result);
162-
Assert.Contains("Valkey", result, StringComparison.OrdinalIgnoreCase);
163-
}
147+
=> AssertContainsServerName(await ClusterClient.LolwutAsync(new LolwutOptions { Version = 5, Parameters = [40, 20] }));
164148

165149
[Fact]
166150
public async Task LolwutAsync_Standalone_WithParametersOnly()
167-
{
168-
string result = await StandaloneClient.LolwutAsync(new LolwutOptions { Parameters = [40, 20] });
169-
Assert.NotEmpty(result);
170-
Assert.Contains("Valkey", result, StringComparison.OrdinalIgnoreCase);
171-
}
151+
=> AssertContainsServerName(await StandaloneClient.LolwutAsync(new LolwutOptions { Parameters = [40, 20] }));
172152

173153
[Fact]
174154
public async Task LolwutAsync_Cluster_WithParametersOnly()
175-
{
176-
string result = await ClusterClient.LolwutAsync(new LolwutOptions { Parameters = [40, 20] });
177-
Assert.NotEmpty(result);
178-
Assert.Contains("Valkey", result, StringComparison.OrdinalIgnoreCase);
179-
}
155+
=> AssertContainsServerName(await ClusterClient.LolwutAsync(new LolwutOptions { Parameters = [40, 20] }));
180156

181157
#endregion
182158

@@ -366,13 +342,19 @@ public async Task WaitAofAsync_Cluster_ReturnsResults()
366342
}
367343

368344
#endregion
345+
346+
/// <summary>
347+
/// Asserts that the result contains the expected server name.
348+
/// </summary>
349+
private static void AssertContainsServerName(string result)
350+
=> Assert.Contains(["VALKEY", "REDIS"], name => result.Contains(name, StringComparison.OrdinalIgnoreCase));
369351
}
370352

371353
/// <summary>
372354
/// Fixture that provides isolated Valkey server instances for server management tests.
373355
/// Tests that call FlushAll/FlushDB need their own servers to avoid interfering with other tests.
374356
/// </summary>
375-
public class ServerManagementFixture : IAsyncLifetime
357+
public class ServerManagementCommandFixture : IAsyncLifetime
376358
{
377359
private StandaloneServer? _standaloneServer;
378360
private ClusterServer? _clusterServer;

0 commit comments

Comments
 (0)