X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c7b7e4d44e9349c9104fbfcd33c5e4b97fe17a71..9a46fb0033514db6dd5e8ab4ccf793f78458a734:/sdk/go/keepclient/keepclient_test.go diff --git a/sdk/go/keepclient/keepclient_test.go b/sdk/go/keepclient/keepclient_test.go index c958695429..5f9915d95c 100644 --- a/sdk/go/keepclient/keepclient_test.go +++ b/sdk/go/keepclient/keepclient_test.go @@ -92,29 +92,6 @@ func (s *ServerRequiredSuite) TestMakeKeepClient(c *C) { } } -func (s *StandaloneSuite) TestShuffleServiceRoots(c *C) { - roots := map[string]string{ - "zzzzz-bi6l4-2q7dq8becevdqfb": "http://localhost:1", - "zzzzz-bi6l4-4gbhck2w7lq0d96": "http://localhost:2", - "zzzzz-bi6l4-4bt69dsk0quh7ae": "http://localhost:3", - "zzzzz-bi6l4-62w1fgd0ud2krxl": "http://localhost:4", - } - kc := KeepClient{} - kc.SetServiceRoots(roots) - - // "foo" acbd18db4cc2f85cedef654fccc4a4d8 - foo_shuffle := []string{"http://localhost:4", "http://localhost:1", "http://localhost:3", "http://localhost:2"} - c.Check(NewRootSorter( - kc.ServiceRoots(), Md5String("foo")).GetSortedRoots(), - DeepEquals, foo_shuffle) - - // "bar" 37b51d194a7513e45b56f6524f2d51f2 - bar_shuffle := []string{"http://localhost:3", "http://localhost:2", "http://localhost:4", "http://localhost:1"} - c.Check(NewRootSorter( - kc.ServiceRoots(), Md5String("bar")).GetSortedRoots(), - DeepEquals, bar_shuffle) -} - type StubPutHandler struct { c *C expectPath string @@ -414,8 +391,14 @@ func (s *StandaloneSuite) TestPutWithFail(c *C) { c.Check(err, Equals, nil) c.Check(phash, Equals, "") c.Check(replicas, Equals, 2) - c.Check(<-st.handled, Equals, shuff[1]) - c.Check(<-st.handled, Equals, shuff[2]) + + s1 := <-st.handled + s2 := <-st.handled + + c.Check((s1 == shuff[1] && s2 == shuff[2]) || + (s1 == shuff[2] && s2 == shuff[1]), + Equals, + true) } func (s *StandaloneSuite) TestPutWithTooManyFail(c *C) {