public void MembershipTableSnapshot_GetSiloStatus_UnknownSilo_KnownSuccessor() { var unknownSilo = Silo("127.0.0.1:100@1"); var knownSuccessor = Silo("127.0.0.1:100@2"); var knownSiloEntry = Entry(knownSuccessor, SiloStatus.Active); var snapshot = MembershipTableSnapshot.Create( knownSiloEntry, Table(knownSiloEntry)); Assert.Equal(SiloStatus.Dead, snapshot.GetSiloStatus(unknownSilo)); }
public void MembershipTableSnapshot_GetSiloStatus_UnknownSilo() { var knownSilo = Silo("127.0.0.1:100@1"); var unknownSilo = Silo("127.0.0.1:101@1"); var knownSiloEntry = Entry(knownSilo, SiloStatus.Active); var snapshot = MembershipTableSnapshot.Create( knownSiloEntry, Table(knownSiloEntry)); Assert.Equal(SiloStatus.None, snapshot.GetSiloStatus(unknownSilo)); }
public void MembershipTableSnapshot_GetSiloStatus_JoiningSilo() { var silo = Silo("127.0.0.1:100@1"); // The table is empty var localSiloEntry = Entry(silo, SiloStatus.Joining); var snapshot = MembershipTableSnapshot.Create( localSiloEntry, Table()); Assert.Equal(localSiloEntry.Status, snapshot.GetSiloStatus(silo)); Assert.Equal(silo, snapshot.LocalSilo.SiloAddress); Assert.Equal(localSiloEntry.Status, snapshot.LocalSilo.Status); Assert.Contains(snapshot.Entries, e => e.Key.Equals(silo) && e.Value.Status == localSiloEntry.Status); }
public void MembershipTableSnapshot_GetSiloStatus_StoppingSilo() { var silo = Silo("127.0.0.1:100@1"); // Check that the Silo status in the entry directly provided to the // constructor overrides the value in the table. var localSiloEntry = Entry(silo, SiloStatus.Stopping); var snapshot = MembershipTableSnapshot.Create( localSiloEntry, Table( Entry(silo, SiloStatus.Active), Entry(Silo("127.0.0.1:200@1"), SiloStatus.Active))); Assert.Equal(localSiloEntry.Status, snapshot.GetSiloStatus(silo)); Assert.Equal(silo, snapshot.LocalSilo.SiloAddress); Assert.Equal(localSiloEntry.Status, snapshot.LocalSilo.Status); Assert.Contains(snapshot.Entries, e => e.Key.Equals(silo) && e.Value.Status == localSiloEntry.Status); }