Skip to content

Fixing time series tests #20

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 3 commits into from
Aug 21, 2022
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
2 changes: 1 addition & 1 deletion src/NRedisStack/TimeSeries/TimeSeriesAux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public static List<object> BuildMultiRangeArgs(TimeStamp fromTimeStamp, TimeStam
args.AddCount(count);
if (align != null) args.AddAlign(align);
args.AddAggregation(aggregation, timeBucket);
if (selectLabels != null) args.AddWithLabels(withLabels, selectLabels);
args.AddWithLabels(withLabels, selectLabels);
args.AddFilters(filter);
args.AddGroupby(groupbyTuple);
return args;
Expand Down
3 changes: 2 additions & 1 deletion src/NRedisStack/TimeSeries/TimeSeriesCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ public async Task<IReadOnlyList<TimeSeriesTuple>> RevRangeAsync(
IReadOnlyCollection<string>? selectLabels = null,
TimeStamp? align = null)
{
var args = TimeSeriesAux.BuildMultiRangeArgs(fromTimeStamp, toTimeStamp, filter, count, aggregation, timeBucket, withLabels, groupbyTuple, filterByTs, filterByValue, selectLabels, align);
var args = TimeSeriesAux.BuildMultiRangeArgs(fromTimeStamp, toTimeStamp, filter, count, aggregation, timeBucket,
withLabels, groupbyTuple, filterByTs, filterByValue, selectLabels, align);
return ResponseParser.ParseMRangeResponse(await _db.ExecuteAsync(TS.MRANGE, args));
}

Expand Down
1 change: 0 additions & 1 deletion tests/NRedisStack.Tests/Tdigest/TdigestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public async Task TestCreateAndInfoAsync()
}
}

//TODO: start async methods from here:
[Fact]
public void TestReset()
{
Expand Down
562 changes: 280 additions & 282 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMRange.cs

Large diffs are not rendered by default.

591 changes: 294 additions & 297 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMRangeAsync.cs

Large diffs are not rendered by default.

566 changes: 282 additions & 284 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMRevRange.cs

Large diffs are not rendered by default.

575 changes: 287 additions & 288 deletions tests/NRedisStack.Tests/TimeSeries/TestAPI/TestMRevRangeAsync.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ namespace NRedisTimeSeries.Test.TestDataTypes
public class TestInformation : AbstractNRedisStackTest
{
public TestInformation(NRedisStack.Tests.RedisFixture redisFixture) : base(redisFixture) { }
//TODO: fix this tests

// [Fact]
// public async Task TestInformationToStringAsync()
// {
// string key = CreateKeyName();
// IDatabase db = redisFixture.Redis.GetDatabase();
// db.Execute("FLUSHALL");
// await db.TS().AddAsync(key, "*", 1.1);
// await db.TS().AddAsync(key, "*", 1.3, duplicatePolicy: TsDuplicatePolicy.LAST);
// TimeSeriesInformation info = await db.TS().InfoAsync(key);
// string[] infoProperties = ((string)info).Trim('{').Trim('}').Split(",");
// Assert.Equal("\"TotalSamples\":2", infoProperties[0]);
// Assert.Equal("\"MemoryUsage\":4184", infoProperties[1]);
// Assert.Equal("\"RetentionTime\":0", infoProperties[4]);
// Assert.Equal("\"ChunkCount\":1", infoProperties[5]);
// Assert.Equal("\"DuplicatePolicy\":null", infoProperties[11]);
// }
[Fact]
public async Task TestInformationAsync()
{
string key = CreateKeyName();
IDatabase db = redisFixture.Redis.GetDatabase();
db.Execute("FLUSHALL");
await db.TS().AddAsync(key, "*", 1.1);
await db.TS().AddAsync(key, "*", 1.3, duplicatePolicy: TsDuplicatePolicy.LAST);
TimeSeriesInformation info = await db.TS().InfoAsync(key);
//Assert.Equal(2, info.TotalSamples);
Assert.Equal(4184, info.MemoryUsage);
Assert.Equal(0, info.RetentionTime);
Assert.Equal(1, info.ChunkCount);
Assert.Equal(null, info.DuplicatePolicy);
}
}
}
}