Skip to content

Commit

Permalink
fix nunit compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
vazois committed Aug 26, 2024
1 parent d38bba9 commit f23d0dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions test/Garnet.test.cluster/ClusterReplicationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,15 +1049,15 @@ public void ClusterReplicateFails()
ClassicAssert.IsTrue(exc.Message.StartsWith("ERR I don't know about node "));
}

[Test, Order(22), Timeout(testTimeout)]
[Test, Order(22), CancelAfter(testTimeout)]
public void ClusterReplicationCheckpointAlignmentTest([Values] bool performRMW)
{
var replica_count = 1;// Per primary
var primary_count = 1;
var nodes_count = primary_count + (primary_count * replica_count);
var primaryNodeIndex = 0;
var replicaNodeIndex = 1;
Assert.IsTrue(primary_count > 0);
ClassicAssert.IsTrue(primary_count > 0);
context.CreateInstances(nodes_count, disableObjects: false, MainMemoryReplication: true, CommitFrequencyMs: -1, OnDemandCheckpoint: true, enableAOF: true, useTLS: useTLS);
context.CreateConnection(useTLS: useTLS);
_ = context.clusterTestUtils.SimpleSetupCluster(primary_count, replica_count, logger: context.logger);
Expand Down Expand Up @@ -1086,8 +1086,8 @@ public void ClusterReplicationCheckpointAlignmentTest([Values] bool performRMW)

var primaryVersion = context.clusterTestUtils.GetInfo(primaryNodeIndex, "store", "CurrentVersion", logger: context.logger);
var replicaVersion = context.clusterTestUtils.GetInfo(replicaNodeIndex, "store", "CurrentVersion", logger: context.logger);
Assert.AreEqual("6", primaryVersion);
Assert.AreEqual(primaryVersion, replicaVersion);
ClassicAssert.AreEqual("6", primaryVersion);
ClassicAssert.AreEqual(primaryVersion, replicaVersion);

context.ValidateKVCollectionAgainstReplica(ref context.kvPairs, replicaNodeIndex);

Expand Down Expand Up @@ -1128,31 +1128,31 @@ public void ClusterReplicationCheckpointAlignmentTest([Values] bool performRMW)
// Assert primary version is 1 and replica has recovered to previous checkpoint
primaryVersion = context.clusterTestUtils.GetInfo(primaryNodeIndex, "store", "CurrentVersion", logger: context.logger);
replicaVersion = context.clusterTestUtils.GetInfo(replicaNodeIndex, "store", "CurrentVersion", logger: context.logger);
Assert.AreEqual("1", primaryVersion);
Assert.AreEqual("6", replicaVersion);
ClassicAssert.AreEqual("1", primaryVersion);
ClassicAssert.AreEqual("6", replicaVersion);

// Setup cluster
Assert.AreEqual("OK", context.clusterTestUtils.AddDelSlotsRange(primaryNodeIndex, [(0, 16383)], addslot: true, logger: context.logger));
ClassicAssert.AreEqual("OK", context.clusterTestUtils.AddDelSlotsRange(primaryNodeIndex, [(0, 16383)], addslot: true, logger: context.logger));
context.clusterTestUtils.SetConfigEpoch(primaryNodeIndex, primaryNodeIndex + 1, logger: context.logger);
context.clusterTestUtils.SetConfigEpoch(replicaNodeIndex, replicaNodeIndex + 1, logger: context.logger);
context.clusterTestUtils.Meet(primaryNodeIndex, replicaNodeIndex, logger: context.logger);
var primaryNodeId = context.clusterTestUtils.ClusterMyId(primaryNodeIndex, logger: context.logger);

// Enable replication
context.clusterTestUtils.WaitUntilNodeIdIsKnown(replicaNodeIndex, primaryNodeId, logger: context.logger);
Assert.AreEqual("OK", context.clusterTestUtils.ClusterReplicate(replicaNodeIndex, primaryNodeIndex, logger: context.logger));
ClassicAssert.AreEqual("OK", context.clusterTestUtils.ClusterReplicate(replicaNodeIndex, primaryNodeIndex, logger: context.logger));

// Both nodes are at version 1 despite replica recovering to version earlier
primaryVersion = context.clusterTestUtils.GetInfo(primaryNodeIndex, "store", "CurrentVersion", logger: context.logger);
replicaVersion = context.clusterTestUtils.GetInfo(replicaNodeIndex, "store", "CurrentVersion", logger: context.logger);
Assert.AreEqual("1", primaryVersion);
Assert.AreEqual("1", replicaVersion);
ClassicAssert.AreEqual("1", primaryVersion);
ClassicAssert.AreEqual("1", replicaVersion);

// At this point attached replica should be empty because primary did not have any data because it did not recover
foreach (var pair in context.kvPairs)
{
var resp = context.clusterTestUtils.GetKey(replicaNodeIndex, Encoding.ASCII.GetBytes(pair.Key), out _, out _, out _, out var state, logger: context.logger);
Assert.IsNull(resp);
ClassicAssert.IsNull(resp);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Garnet.test.cluster/ClusterTestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,7 @@ public string GetInfo(IPEndPoint endPoint, string section, string segment, ILogg
{
var server = redis.GetServer(endPoint);
var result = server.Info(section);
Assert.AreEqual(1, result.Length, "section does not exist");
ClassicAssert.AreEqual(1, result.Length, "section does not exist");
foreach (var item in result[0])
if (item.Key.Equals(segment))
return item.Value;
Expand Down

0 comments on commit f23d0dd

Please sign in to comment.