11 "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
12 "git.curoverse.com/arvados.git/sdk/go/arvadostest"
15 func ExampleKeepClient_RefreshServices() {
16 arv, err := arvadosclient.MakeArvadosClient()
20 kc, err := MakeKeepClient(arv)
24 go kc.RefreshServices(5*time.Minute, 3*time.Second)
25 fmt.Printf("LocalRoots: %#v\n", kc.LocalRoots())
28 func (s *ServerRequiredSuite) TestOverrideDiscovery(c *check.C) {
29 defer os.Setenv("ARVADOS_KEEP_SERVICES", "")
31 hash := fmt.Sprintf("%x+3", md5.Sum([]byte("TestOverrideDiscovery")))
35 arvadostest.ActiveToken,
37 []byte("TestOverrideDiscovery")}
38 ks := RunSomeFakeKeepServers(st, 2)
40 os.Setenv("ARVADOS_KEEP_SERVICES", "")
41 arv1, err := arvadosclient.MakeArvadosClient()
42 c.Assert(err, check.IsNil)
43 arv1.ApiToken = arvadostest.ActiveToken
45 os.Setenv("ARVADOS_KEEP_SERVICES", ks[0].url+" "+ks[1].url+" ")
46 arv2, err := arvadosclient.MakeArvadosClient()
47 c.Assert(err, check.IsNil)
48 arv2.ApiToken = arvadostest.ActiveToken
50 // ARVADOS_KEEP_SERVICES was empty when we created arv1, but
51 // it pointed to our stub servers when we created
52 // arv2. Regardless of what it's set to now, a keepclient for
53 // arv2 should use our stub servers, but one created for arv1
56 kc1, err := MakeKeepClient(arv1)
57 c.Assert(err, check.IsNil)
58 kc2, err := MakeKeepClient(arv2)
59 c.Assert(err, check.IsNil)
61 _, _, _, err = kc1.Get(hash)
62 c.Check(err, check.NotNil)
63 _, _, _, err = kc2.Get(hash)
64 c.Check(err, check.IsNil)