From 838c010634b2fcc6aa69d28e28edae16b5db37b0 Mon Sep 17 00:00:00 2001 From: Vasileios Zois Date: Fri, 30 Aug 2024 16:25:55 -0700 Subject: [PATCH] update nunit legacy methods --- .../ClusterReplicationTests.cs | 22 +++++++++---------- test/Garnet.test.cluster/ClusterTestUtils.cs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/Garnet.test.cluster/ClusterReplicationTests.cs b/test/Garnet.test.cluster/ClusterReplicationTests.cs index 4856727eb5..2f5c67af74 100644 --- a/test/Garnet.test.cluster/ClusterReplicationTests.cs +++ b/test/Garnet.test.cluster/ClusterReplicationTests.cs @@ -1049,7 +1049,7 @@ 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 @@ -1057,7 +1057,7 @@ public void ClusterReplicationCheckpointAlignmentTest([Values] bool performRMW) 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); @@ -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); @@ -1128,11 +1128,11 @@ 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); @@ -1140,19 +1140,19 @@ public void ClusterReplicationCheckpointAlignmentTest([Values] bool performRMW) // 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); } } } diff --git a/test/Garnet.test.cluster/ClusterTestUtils.cs b/test/Garnet.test.cluster/ClusterTestUtils.cs index c114e7e069..2653fe5374 100644 --- a/test/Garnet.test.cluster/ClusterTestUtils.cs +++ b/test/Garnet.test.cluster/ClusterTestUtils.cs @@ -2688,7 +2688,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;