Skip to content
Browse files

Minor change to make sure test will not fail because of expected errors

  • Loading branch information...
1 parent 92cb59e commit 9df557f8eff93b203cfa9505253dc7d280f16034 @ayende committed Sep 2, 2009
Showing with 14 additions and 9 deletions.
  1. +14 −9 Rhino.DistributedHashTable.ClusterTests/ClusterTests.cs
View
23 Rhino.DistributedHashTable.ClusterTests/ClusterTests.cs
@@ -243,12 +243,16 @@ public void WillReplicateValuesToSecondJoin()
using (var nodeB = new DistributedHashTableStorageClient(storageHostB.Endpoint))
{
var topology = masterProxy.GetTopology();
- var values = nodeB.Get(topology.Version, new ExtendedGetRequest
- {
- Key = "abc",
- Segment = 1
- });
- Assert.Equal(new byte[] { 2, 2, 0, 0 }, values[0][0].Data);
+ Value[][] values = null;
+ RepeatWhileThereAreTopologyChangedErrors(() =>
+ {
+ values = nodeB.Get(topology.Version, new ExtendedGetRequest
+ {
+ Key = "abc",
+ Segment = 1
+ });
+ });
+ Assert.Equal(new byte[] { 2, 2, 0, 0 }, values[0][0].Data);
}
}
}
@@ -257,18 +261,19 @@ public void WillReplicateValuesToSecondJoin()
// with segments moving & topology changes
public static void RepeatWhileThereAreTopologyChangedErrors(Action action)
{
- while(true)
- {
+ for (int i = 0; i < 10; i++)
+ {
try
{
action();
- break;
+ return;
}
catch (TopologyVersionDoesNotMatchException)
{
Thread.Sleep(250);
}
}
+ throw new InvalidOperationException("Could not execute action because we got too many TopologyVersionDoesNotMatchException");
}
}
}

0 comments on commit 9df557f

Please sign in to comment.
Something went wrong with that request. Please try again.