Skip to content

adjustments to run in .NET Framework, adding job to run tests for .NET Framework #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ env:

jobs:

windows:
name: windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: run redis-stack-server docker
run: docker run -p 6379:6379 -d redis/redis-stack-server:edge
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test --no-build --verbosity normal -f net481
build_and_test:
name: Build and test
runs-on: ubuntu-latest
Expand All @@ -35,8 +48,10 @@ jobs:
run: dotnet restore
- name: Build
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test -f net6.0 --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Test
run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
run: dotnet test -f net7.0 --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions src/NRedisStack/ResponseParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public static long ToLong(this RedisResult result)

public static double ToDouble(this RedisResult result)
{
if (result.ToString() == "nan")
return double.NaN;
if ((double?)result == null)
throw new ArgumentNullException(nameof(result));
return (double)result;
Expand Down
4 changes: 3 additions & 1 deletion src/NRedisStack/Tdigest/TdigestCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public double Max(RedisKey key)
/// <inheritdoc/>
public double Min(RedisKey key)
{
return _db.Execute(TdigestCommandBuilder.Min(key)).ToDouble();
var cmd = TdigestCommandBuilder.Min(key);
var res =_db.Execute(cmd);
return res.ToDouble();
}

/// <inheritdoc/>
Expand Down
3 changes: 2 additions & 1 deletion tests/NRedisStack.Tests/NRedisStack.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net462</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
8 changes: 6 additions & 2 deletions tests/NRedisStack.Tests/Tdigest/TdigestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ static Tuple<double, long> RandomValueWeight()
{
Random random = new Random();

return new Tuple<double, long>(random.NextDouble() * 10000, random.NextInt64() + 1);
return new Tuple<double, long>(random.NextDouble() * 10000, random.Next() + 1);
}

static Tuple<double, long>[] RandomValueWeightArray(int count)
Expand All @@ -687,7 +687,11 @@ static Tuple<double, long> DefinedValueWeight(double value, long weight)
private static double[] WeightedValue(double value, int weight)
{
double[] values = new double[weight];
Array.Fill(values, value);
for (var i = 0; i < values.Length; i++)
{
values[i] = value;
}

return values;
}
}
3 changes: 2 additions & 1 deletion tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMADD.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NRedisStack.DataTypes;
using NRedisStack.Literals.Enums;
using NRedisStack.RedisStackCommands;
using StackExchange.Redis;
using Xunit;
Expand Down Expand Up @@ -88,7 +89,7 @@ public void TestOverrideMADD()

foreach (string key in keys)
{
ts.Create(key);
ts.Create(key, duplicatePolicy: TsDuplicatePolicy.MAX);
}

List<DateTime> oldTimeStamps = new List<DateTime>();
Expand Down
3 changes: 2 additions & 1 deletion tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMAddAsync.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using NRedisStack.DataTypes;
using NRedisStack.Literals.Enums;
using NRedisStack.RedisStackCommands;
using StackExchange.Redis;
using Xunit;
Expand Down Expand Up @@ -82,7 +83,7 @@ public async Task TestOverrideMAdd()

foreach (var key in keys)
{
await ts.CreateAsync(key);
await ts.CreateAsync(key, duplicatePolicy: TsDuplicatePolicy.MAX);
}

var oldTimeStamps = new List<DateTime>();
Expand Down