1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
15 "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
16 "git.curoverse.com/arvados.git/sdk/go/arvadostest"
19 func (s *ServerRequiredSuite) TestOverrideDiscovery(c *check.C) {
20 defer os.Setenv("ARVADOS_KEEP_SERVICES", "")
22 hash := fmt.Sprintf("%x+3", md5.Sum([]byte("TestOverrideDiscovery")))
26 arvadostest.ActiveToken,
28 []byte("TestOverrideDiscovery")}
29 ks := RunSomeFakeKeepServers(st, 2)
31 os.Setenv("ARVADOS_KEEP_SERVICES", "")
32 arv1, err := arvadosclient.MakeArvadosClient()
33 c.Assert(err, check.IsNil)
34 arv1.ApiToken = arvadostest.ActiveToken
36 os.Setenv("ARVADOS_KEEP_SERVICES", ks[0].url+" "+ks[1].url+" ")
37 arv2, err := arvadosclient.MakeArvadosClient()
38 c.Assert(err, check.IsNil)
39 arv2.ApiToken = arvadostest.ActiveToken
41 // ARVADOS_KEEP_SERVICES was empty when we created arv1, but
42 // it pointed to our stub servers when we created
43 // arv2. Regardless of what it's set to now, a keepclient for
44 // arv2 should use our stub servers, but one created for arv1
47 kc1, err := MakeKeepClient(arv1)
48 c.Assert(err, check.IsNil)
49 kc2, err := MakeKeepClient(arv2)
50 c.Assert(err, check.IsNil)
52 _, _, _, err = kc1.Get(hash)
53 c.Check(err, check.NotNil)
54 _, _, _, err = kc2.Get(hash)
55 c.Check(err, check.IsNil)