15370: Fix flaky test.
[arvados.git] / sdk / go / keepclient / discover.go
index 744ff826853895c1769a5865d8dbded75ddc1474..5eafbbe339a9d7d4baa29081a049aa5e924ac61f 100644 (file)
@@ -19,7 +19,7 @@ import (
        "git.arvados.org/arvados.git/sdk/go/arvadosclient"
 )
 
-// ClearCache clears the Keep service discovery cache.
+// RefreshServiceDiscovery clears the Keep service discovery cache.
 func RefreshServiceDiscovery() {
        var wg sync.WaitGroup
        defer wg.Wait()
@@ -35,8 +35,8 @@ func RefreshServiceDiscovery() {
        }
 }
 
-// ClearCacheOnSIGHUP installs a signal handler that calls
-// ClearCache when SIGHUP is received.
+// RefreshServiceDiscoveryOnSIGHUP installs a signal handler that calls
+// RefreshServiceDiscovery when SIGHUP is received.
 func RefreshServiceDiscoveryOnSIGHUP() {
        svcListCacheMtx.Lock()
        defer svcListCacheMtx.Unlock()
@@ -138,6 +138,10 @@ func (kc *KeepClient) discoverServices() error {
                return nil
        }
 
+       if kc.Arvados.ApiServer == "" {
+               return fmt.Errorf("Arvados client is not configured (target API host is not set). Maybe env var ARVADOS_API_HOST should be set first?")
+       }
+
        svcListCacheMtx.Lock()
        cacheEnt, ok := svcListCache[kc.Arvados.ApiServer]
        if !ok {