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