mirror of https://github.com/databricks/cli.git
acc: add $UNIQUE_NAME env var and replacement (#2474)
Useful for integration tests where project names must be unique. I'm using it in #2471
This commit is contained in:
parent
6a7c7d75d7
commit
f8f3d669bc
|
@ -3,6 +3,7 @@ package acceptance_test
|
|||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/base32"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"flag"
|
||||
|
@ -258,6 +259,10 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
|
|||
}
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
uniqueName := strings.Trim(base32.StdEncoding.EncodeToString(id[:]), "=")
|
||||
repls.Set(uniqueName, "[UNIQUE_NAME]")
|
||||
|
||||
var tmpDir string
|
||||
var err error
|
||||
if KeepTmp {
|
||||
|
@ -283,6 +288,7 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
|
|||
args := []string{"bash", "-euo", "pipefail", EntryPointScript}
|
||||
cmd := exec.Command(args[0], args[1:]...)
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, "UNIQUE_NAME="+uniqueName)
|
||||
|
||||
var workspaceClient *databricks.WorkspaceClient
|
||||
var user iam.User
|
||||
|
|
Loading…
Reference in New Issue