Skip to content
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
6 changes: 3 additions & 3 deletions test/Garnet.test.cluster/ClusterManagementTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System;
Expand Down Expand Up @@ -355,15 +355,15 @@ public async Task ClusterResetDisposesGossipConnections()
context.clusterTestUtils.WaitUntilNodeIsKnownByAllNodes(i);
}

await Task.Delay(1000);
await Task.Delay(1000).ConfigureAwait(false);

var server = context.clusterTestUtils.GetServer(0);
var gossipConnections = GetStat(server, "Stats", "gossip_open_connections");
ClassicAssert.AreEqual(node_count - 1, int.Parse(gossipConnections), "Expected one gossip connection per node.");

context.clusterTestUtils.ClusterReset(0, soft: true);

await Task.Delay(1000);
await Task.Delay(1000).ConfigureAwait(false);

gossipConnections = GetStat(server, "Stats", "gossip_open_connections");
ClassicAssert.AreEqual("0", gossipConnections, "All gossip connections should be closed after a reset.");
Expand Down
4 changes: 2 additions & 2 deletions test/Garnet.test.cluster/ClusterMigrateTLSTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System.Threading;
Expand Down Expand Up @@ -81,6 +81,6 @@ public void ClusterTLSMigrateKeysWithObjects()
[Test, Order(11)]
[Category("CLUSTER"), CancelAfter(100000)]
public async Task ClusterTLSMigrateContinuousReadWrite(CancellationToken cancellationToken)
=> await tests.ClusterSimpleMigrateContinuousReadWrite(cancellationToken);
=> await tests.ClusterSimpleMigrateContinuousReadWrite(cancellationToken).ConfigureAwait(false);
}
}
14 changes: 7 additions & 7 deletions test/Garnet.test.cluster/ClusterMigrateTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System;
Expand Down Expand Up @@ -1138,14 +1138,14 @@ public void ClusterSimpleMigrateKeysWithObjects()
{
ClusterTestUtils.RandomBytes(ref r, ref buffer);
SET[2] = Encoding.ASCII.GetString(buffer);
var resp = await c.ExecuteAsync(SET);
var resp = await c.ExecuteAsync(SET).ConfigureAwait(false);
ClassicAssert.AreEqual("OK", resp);
value = SET[2];
Interlocked.Increment(ref setsExecuted);
}
else
{
var resp = await c.ExecuteAsync(GET);
var resp = await c.ExecuteAsync(GET).ConfigureAwait(false);
ClassicAssert.AreEqual(SET[2], resp);
}
}
Expand Down Expand Up @@ -1215,20 +1215,20 @@ public async Task ClusterSimpleMigrateContinuousReadWrite(CancellationToken canc

// Wait until few sets have executed
while (setsExecuted < 100)
await Task.Delay(100, cancellationToken);
await Task.Delay(100, cancellationToken).ConfigureAwait(false);

// Initiate migration
var sourceEndPoint = context.clusterTestUtils.GetEndPoint(srcNodeIndex);
var targetEndPoint = context.clusterTestUtils.GetEndPoint(dstNodeIndex);
context.clusterTestUtils.MigrateSlots(sourceEndPoint, targetEndPoint, migrateSlots, range: true, logger: context.logger);

// Wait until all operations are done
_ = await Task.WhenAll(tasks).WaitAsync(cancellationToken);
_ = await Task.WhenAll(tasks).WaitAsync(cancellationToken).ConfigureAwait(false);

// Validate data on target node
foreach (var task in tasks)
{
var (key, value, slot) = await task;
var (key, value, slot) = await task.ConfigureAwait(false);
ClassicAssert.AreEqual(slot, ClusterTestUtils.HashSlot(Encoding.ASCII.GetBytes(key)));

var retry = true;
Expand All @@ -1237,7 +1237,7 @@ public async Task ClusterSimpleMigrateContinuousReadWrite(CancellationToken canc
try
{
var c = context.clusterTestUtils.GetGarnetClientSession(dstNodeIndex, useTLS: UseTLS);
var result = await c.ExecuteAsync(["GET", key]).WaitAsync(cancellationToken);
var result = await c.ExecuteAsync(["GET", key]).WaitAsync(cancellationToken).ConfigureAwait(false);
ClassicAssert.AreEqual(value, result);
retry = false;
}
Expand Down
4 changes: 2 additions & 2 deletions test/Garnet.test.cluster/ClusterNegativeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System;
Expand Down Expand Up @@ -513,7 +513,7 @@ public async Task ClusterParallelFailoverOnDistinctShards(CancellationToken canc

for (var i = 0; i < 10; i++)
{
await Task.Delay(500);
await Task.Delay(500).ConfigureAwait(false);
var cluster = context.clusterTestUtils.ClusterNodes(3);
var replicaWithHashSlots = cluster.Nodes.FirstOrDefault(x => x.IsReplica && x.Slots.Count > 0);
if (replicaWithHashSlots != null)
Expand Down
4 changes: 2 additions & 2 deletions test/Garnet.test.cluster/ClusterTestUtils.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System;
Expand Down Expand Up @@ -232,7 +232,7 @@ private async Task<bool> WaitForEpochSync(IPEndPoint endPoint)
var configInfo = NodesMyself(endPoint, [ClusterInfoTag.NODEID, ClusterInfoTag.CONFIG_EPOCH]);
while (true)
{
await Task.Delay(endpoints.Length * 100);
await Task.Delay(endpoints.Length * 100).ConfigureAwait(false);
retry:
foreach (var endpoint in endpoints)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

using System;
Expand Down Expand Up @@ -1398,23 +1398,23 @@ public async Task ReplicaSyncTaskFaultsRecoverAsync(ExceptionInjectionType fault

keyCount++;

await Task.Delay(10);
await Task.Delay(10).ConfigureAwait(false);
}
},
cancellation
);

await Task.Delay(100, cancellation);
await Task.Delay(100, cancellation).ConfigureAwait(false);

// Force replica to continually fault
ExceptionInjectionHelper.EnableException(faultType);

// Give it enough time to die horribly
await Task.Delay(100, cancellation);
await Task.Delay(100, cancellation).ConfigureAwait(false);

// Stop primary writes
primaryInsertCancel.Cancel();
await continuallyWriteToPrimaryTask;
await continuallyWriteToPrimaryTask.ConfigureAwait(false);

// Resolve fault on replica
ExceptionInjectionHelper.DisableException(faultType);
Expand Down Expand Up @@ -1461,7 +1461,7 @@ public async Task ClusterReplicationMultiRestartRecover()
var restartRecover = 10;
tasks.Add(Task.Run(() => RestartRecover(restartRecover)));

await Task.WhenAll(tasks);
await Task.WhenAll(tasks).ConfigureAwait(false);
context.clusterTestUtils.WaitForReplicaAofSync(primaryNodeIndex, replicaNodeIndex, context.logger);

// Validate that replica has the same keys as primary
Expand Down Expand Up @@ -1533,7 +1533,7 @@ public async Task ReplicasRestartAsReplicasAsync(CancellationToken cancellation)
context.RestartNode(replica);

// Delay a bit for replication init tasks to fire off
await Task.Delay(100, cancellation);
await Task.Delay(100, cancellation).ConfigureAwait(false);

// Make sure replica did not promote to Primary
ClassicAssert.AreEqual("slave", context.clusterTestUtils.RoleCommand(replica).Value);
Expand Down Expand Up @@ -1650,7 +1650,7 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
writtenToPrimary1[key] = value;
}

await Task.Delay(10, writeTaskCancel.Token);
await Task.Delay(10, writeTaskCancel.Token).ConfigureAwait(false);
}
catch
{
Expand Down Expand Up @@ -1691,7 +1691,7 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
writtenToPrimary2[key] = value;
}

await Task.Delay(10, writeTaskCancel.Token);
await Task.Delay(10, writeTaskCancel.Token).ConfigureAwait(false);
}
catch
{
Expand All @@ -1713,7 +1713,7 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
{
try
{
_ = await node.Store.CommitAOFAsync(writeTaskCancel.Token);
_ = await node.Store.CommitAOFAsync(writeTaskCancel.Token).ConfigureAwait(false);
}
catch (TaskCanceledException)
{
Expand All @@ -1728,7 +1728,7 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy

try
{
await Task.Delay(100, writeTaskCancel.Token);
await Task.Delay(100, writeTaskCancel.Token).ConfigureAwait(false);
}
catch
{
Expand All @@ -1742,14 +1742,14 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
// Wait for a bit, optionally injecting a fault
if (faultType == ExceptionInjectionType.None)
{
await Task.Delay(10_000, cancellation);
await Task.Delay(10_000, cancellation).ConfigureAwait(false);
}
else
{
var timer = Stopwatch.StartNew();

// Things start fine
await Task.Delay(1_000, cancellation);
await Task.Delay(1_000, cancellation).ConfigureAwait(false);

// Wait for something to get replicated
var replica1Happened = false;
Expand Down Expand Up @@ -1788,12 +1788,12 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
}
}

await Task.Delay(100, cancellation);
await Task.Delay(100, cancellation).ConfigureAwait(false);
} while (!replica1Happened || !replica2Happened);

// Things fail for a bit
ExceptionInjectionHelper.EnableException(faultType);
await Task.Delay(2_000, cancellation);
await Task.Delay(2_000, cancellation).ConfigureAwait(false);

// Things recover
ExceptionInjectionHelper.DisableException(faultType);
Expand All @@ -1803,15 +1803,15 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
// Wait out the rest of the duration
if (timer.ElapsedMilliseconds < 10_000)
{
await Task.Delay((int)(10_000 - timer.ElapsedMilliseconds), cancellation);
await Task.Delay((int)(10_000 - timer.ElapsedMilliseconds), cancellation).ConfigureAwait(false);
}
}

// Stop writing
writeTaskCancel.Cancel();

// Wait for all our writes and checkpoints to spin down
await Task.WhenAll(writeToPrimary1Task, writeToPrimary2Task, checkpointTask);
await Task.WhenAll(writeToPrimary1Task, writeToPrimary2Task, checkpointTask).ConfigureAwait(false);
}

// Shutdown all primaries
Expand All @@ -1821,7 +1821,7 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
// Sometimes we can intervene post-Primary crash but pre-Replica crash, simulate that
if (replicaFailoverBeforeShutdown)
{
await UpgradeReplicasAsync(context, replica1, replica2, cancellation);
await UpgradeReplicasAsync(context, replica1, replica2, cancellation).ConfigureAwait(false);
}

// Shutdown the (old) replicas
Expand All @@ -1835,7 +1835,7 @@ public async Task PrimaryUnavailableRecoveryAsync(ExceptionInjectionType faultTy
// If we didn't promte pre-crash, promote now that Replicas came back
if (!replicaFailoverBeforeShutdown)
{
await UpgradeReplicasAsync(context, replica1, replica2, cancellation);
await UpgradeReplicasAsync(context, replica1, replica2, cancellation).ConfigureAwait(false);
}

// Confirm that at least some of the data is available on each Replica
Expand Down Expand Up @@ -1876,7 +1876,7 @@ static async Task UpgradeReplicasAsync(ClusterTestContext context, IPEndPoint re
// Wait for roles to update
while (true)
{
await Task.Delay(10, cancellation);
await Task.Delay(10, cancellation).ConfigureAwait(false);

if (context.clusterTestUtils.RoleCommand(replica1).Value != "master")
{
Expand Down Expand Up @@ -2098,14 +2098,14 @@ public async Task ClusterReplicationObjectCollectTest(bool useManualCollect, Can
// Execute first hash set workload
var hashSetKey = "myhash";
ExecuteHashSet(hashSetKey, elements);
await Task.Delay(3000);
await Task.Delay(3000).ConfigureAwait(false);
ManualCollect();
ValidateHashSet(hashSetKey);

// Execute second hash set workload
hashSetKey = "myhash2";
ExecuteHashSet(hashSetKey, elements);
await Task.Delay(3000);
await Task.Delay(3000).ConfigureAwait(false);
ManualCollect();
ValidateHashSet(hashSetKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public async Task ClusterResetHardDuringDisklessReplicationAttach(CancellationTo

var resp = context.clusterTestUtils.ClusterReplicate(replicaNodeIndex: replicaIndex, primaryNodeIndex: primaryIndex, failEx: false, async: true, logger: context.logger);

await Task.Delay(1000, cancellationToken);
await Task.Delay(1000, cancellationToken).ConfigureAwait(false);

// Verify that the replica is in a replicating state
var replicationInfo = context.clusterTestUtils.GetReplicationInfo(replicaIndex, [ReplicationInfoItem.RECOVER_STATUS], logger: context.logger);
Expand Down Expand Up @@ -129,7 +129,7 @@ public async Task ClusterResetHardDuringDiskBasedReplicationAttach(CancellationT

var resp = context.clusterTestUtils.ClusterReplicate(replicaNodeIndex: replicaIndex, primaryNodeIndex: primaryIndex, failEx: false, async: true, logger: context.logger);

await Task.Delay(1000, cancellationToken);
await Task.Delay(1000, cancellationToken).ConfigureAwait(false);

// Verify that the replica is in a replicating state
var replicationInfo = context.clusterTestUtils.GetReplicationInfo(replicaIndex, [ReplicationInfoItem.RECOVER_STATUS], logger: context.logger);
Expand Down
Loading