summaryrefslogtreecommitdiffstats
path: root/client/go/cmd/command_tester.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-09-24 17:27:49 +0200
committerMartin Polden <mpolden@mpolden.no>2021-09-24 17:39:34 +0200
commitabcbbd676f3b1a8cbd3cde5863121ad7c05d1568 (patch)
tree3ed6f2688617660e3f5398224deae393e6a41229 /client/go/cmd/command_tester.go
parenta352e0c0a88d8d66530f17c8ae7a986930f179e5 (diff)
Cache sample apps
Diffstat (limited to 'client/go/cmd/command_tester.go')
-rw-r--r--client/go/cmd/command_tester.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/client/go/cmd/command_tester.go b/client/go/cmd/command_tester.go
index a0c3183ca4c..71f821521df 100644
--- a/client/go/cmd/command_tester.go
+++ b/client/go/cmd/command_tester.go
@@ -22,6 +22,7 @@ import (
type command struct {
homeDir string
+ cacheDir string
args []string
moreArgs []string
}
@@ -31,12 +32,16 @@ func execute(cmd command, t *testing.T, client *mockHttpClient) (string, string)
util.ActiveHttpClient = client
}
- // Set config dir. Use a separate one per test if none is specified
+ // Set Vespa CLI directories. Use a separate one per test if none is specified
if cmd.homeDir == "" {
cmd.homeDir = filepath.Join(t.TempDir(), ".vespa")
viper.Reset()
}
+ if cmd.cacheDir == "" {
+ cmd.cacheDir = filepath.Join(t.TempDir(), ".cache", "vespa")
+ }
os.Setenv("VESPA_CLI_HOME", cmd.homeDir)
+ os.Setenv("VESPA_CLI_CACHE_DIR", cmd.cacheDir)
// Reset flags to their default value - persistent flags in Cobra persists over tests
rootCmd.Flags().VisitAll(func(f *pflag.Flag) {