Skip to content

Commit 31ce11d

Browse files
authored
Merge pull request #1598 from StackExchange/craver/build-errors2
Fundamentally, JRediSearch is doing this, and bases test assumptions on it. To get back to a decent/matching state, we need to do the same. It also brings in the hash failure check from https://github.com/RediSearch/JRediSearch/blob/f1d7e2ed64a18e99b31b3b7fe48bb972c00e3999/src/test/java/io/redisearch/client/ClientTest.java#L403-L408
2 parents b634be8 + a41780c commit 31ce11d

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

.github/workflows/Linux.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010
- '!/docs/*' # Don't run workflow when files are only in the /docs directory
1111

1212
jobs:
13-
build:
14-
name: Ubuntu
13+
main:
14+
name: StackExchange.Redis (Ubuntu)
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
@@ -23,7 +23,23 @@ jobs:
2323
run: docker-compose -f docker-compose.yml up -d
2424
- name: StackExchange.Redis.Tests
2525
run: dotnet test tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj -c Release --logger GitHubActions /p:CI=true
26+
- name: .NET Lib Pack
27+
run: dotnet pack src/StackExchange.Redis/StackExchange.Redis.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
28+
29+
nredisearch:
30+
name: NRediSearch (Ubuntu)
31+
runs-on: ubuntu-latest
32+
services:
33+
redisearch:
34+
image: redislabs/redisearch:latest
35+
ports:
36+
- 6385:6379
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v1
40+
- name: .NET Build
41+
run: dotnet build Build.csproj -c Release /p:CI=true
2642
- name: NRedisSearch.Tests
2743
run: dotnet test tests/NRediSearch.Test/NRediSearch.Test.csproj -c Release --logger GitHubActions /p:CI=true
2844
- name: .NET Lib Pack
29-
run: dotnet pack Build.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
45+
run: dotnet pack src/NRediSearch/NRediSearch.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true

tests/NRediSearch.Test/ClientTests/ClientTest.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,15 @@ public void TestAddHash()
300300
Db.KeyDelete(hashKey);
301301
Db.HashSet(hashKey, "title", "hello world");
302302

303-
Assert.True(cl.AddHash(hashKey, 1, false));
303+
try
304+
{
305+
Assert.True(cl.AddHash(hashKey, 1, false));
306+
}
307+
catch (RedisServerException e)
308+
{
309+
Assert.StartsWith("ERR unknown command `FT.ADDHASH`", e.Message);
310+
return; // Starting from RediSearch 2.0 this command is not supported anymore
311+
}
304312
SearchResult res = cl.Search(new Query("hello world").SetVerbatim());
305313
Assert.Equal(1, res.TotalResults);
306314
Assert.Equal(hashKey, res.Documents[0].Id);

tests/NRediSearch.Test/RediSearchTestBase.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
using System.Runtime.CompilerServices;
44
using StackExchange.Redis;
55
using StackExchange.Redis.Tests;
6+
using Xunit;
67
using Xunit.Abstractions;
78

89
namespace NRediSearch.Test
910
{
11+
[Collection(nameof(NonParallelCollection))]
1012
public abstract class RediSearchTestBase : IDisposable
1113
{
1214
protected readonly ITestOutputHelper Output;
@@ -15,6 +17,8 @@ protected RediSearchTestBase(ITestOutputHelper output)
1517
muxer = GetWithFT(output);
1618
Output = output;
1719
Db = muxer.GetDatabase();
20+
var server = muxer.GetServer(muxer.GetEndPoints()[0]);
21+
server.FlushDatabase();
1822
}
1923
private ConnectionMultiplexer muxer;
2024
protected IDatabase Db { get; private set; }
@@ -155,4 +159,7 @@ protected bool IsMissingIndexException(Exception ex)
155159
|| ex.Message.Contains("no such index", StringComparison.InvariantCultureIgnoreCase);
156160
}
157161
}
162+
163+
[CollectionDefinition(nameof(NonParallelCollection), DisableParallelization = true)]
164+
public class NonParallelCollection { }
158165
}

tests/RedisConfigs/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
version: '2.4'
1+
version: '2.5'
22

33
services:
44
redisearch:
5-
image: redislabs/redisearch
5+
image: redislabs/redisearch:latest
66
ports:
77
- 6385:6379
88
redis:

0 commit comments

Comments
 (0)