mirror of https://github.com/databricks/cli.git
acc: add -forcerun flag (#2480)
If set, all skip directives are ignored. It is useful to run test on OS / Cloud where it is not normally enabled without having to edit test.toml
This commit is contained in:
parent
b2c87ae5d0
commit
d9695fe1e8
|
@ -39,6 +39,7 @@ var (
|
||||||
NoRepl bool
|
NoRepl bool
|
||||||
VerboseTest bool = os.Getenv("VERBOSE_TEST") != ""
|
VerboseTest bool = os.Getenv("VERBOSE_TEST") != ""
|
||||||
Tail bool
|
Tail bool
|
||||||
|
Forcerun bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// In order to debug CLI running under acceptance test, set this to full subtest name, e.g. "bundle/variables/empty"
|
// In order to debug CLI running under acceptance test, set this to full subtest name, e.g. "bundle/variables/empty"
|
||||||
|
@ -56,6 +57,7 @@ func init() {
|
||||||
flag.BoolVar(&KeepTmp, "keeptmp", false, "Do not delete TMP directory after run")
|
flag.BoolVar(&KeepTmp, "keeptmp", false, "Do not delete TMP directory after run")
|
||||||
flag.BoolVar(&NoRepl, "norepl", false, "Do not apply any replacements (for debugging)")
|
flag.BoolVar(&NoRepl, "norepl", false, "Do not apply any replacements (for debugging)")
|
||||||
flag.BoolVar(&Tail, "tail", false, "Log output of script in real time. Use with -v to see the logs: -tail -v")
|
flag.BoolVar(&Tail, "tail", false, "Log output of script in real time. Use with -v to see the logs: -tail -v")
|
||||||
|
flag.BoolVar(&Forcerun, "forcerun", false, "Force running the specified tests, ignore all reasons to skip")
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -82,7 +84,7 @@ func TestAccept(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInprocessMode(t *testing.T) {
|
func TestInprocessMode(t *testing.T) {
|
||||||
if InprocessMode {
|
if InprocessMode && !Forcerun {
|
||||||
t.Skip("Already tested by TestAccept")
|
t.Skip("Already tested by TestAccept")
|
||||||
}
|
}
|
||||||
require.Equal(t, 1, testAccept(t, true, "selftest/basic"))
|
require.Equal(t, 1, testAccept(t, true, "selftest/basic"))
|
||||||
|
@ -226,23 +228,26 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
|
||||||
|
|
||||||
isEnabled, isPresent := config.GOOS[runtime.GOOS]
|
isEnabled, isPresent := config.GOOS[runtime.GOOS]
|
||||||
if isPresent && !isEnabled {
|
if isPresent && !isEnabled {
|
||||||
|
if !Forcerun {
|
||||||
t.Skipf("Disabled via GOOS.%s setting in %s", runtime.GOOS, configPath)
|
t.Skipf("Disabled via GOOS.%s setting in %s", runtime.GOOS, configPath)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cloudEnv := os.Getenv("CLOUD_ENV")
|
cloudEnv := os.Getenv("CLOUD_ENV")
|
||||||
isRunningOnCloud := cloudEnv != ""
|
isRunningOnCloud := cloudEnv != ""
|
||||||
tailOutput := Tail
|
tailOutput := Tail
|
||||||
|
|
||||||
|
if isRunningOnCloud && isTruePtr(config.CloudSlow) && testing.Verbose() {
|
||||||
|
// Combination of CloudSlow and -v auto-enables -tail
|
||||||
|
tailOutput = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if !Forcerun {
|
||||||
if isRunningOnCloud {
|
if isRunningOnCloud {
|
||||||
if isTruePtr(config.CloudSlow) {
|
if isTruePtr(config.CloudSlow) {
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skipf("Disabled via CloudSlow setting in %s (CLOUD_ENV=%s, Short=%v)", configPath, cloudEnv, testing.Short())
|
t.Skipf("Disabled via CloudSlow setting in %s (CLOUD_ENV=%s, Short=%v)", configPath, cloudEnv, testing.Short())
|
||||||
}
|
}
|
||||||
|
|
||||||
if testing.Verbose() {
|
|
||||||
// Combination of CloudSlow and -v auto-enables -tail
|
|
||||||
tailOutput = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isCloudEnabled := isTruePtr(config.Cloud) || isTruePtr(config.CloudSlow)
|
isCloudEnabled := isTruePtr(config.Cloud) || isTruePtr(config.CloudSlow)
|
||||||
|
@ -265,6 +270,7 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
|
||||||
t.Skipf("Disabled via Local setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
|
t.Skipf("Disabled via Local setting in %s (CLOUD_ENV=%s)", configPath, cloudEnv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
uniqueName := strings.Trim(base32.StdEncoding.EncodeToString(id[:]), "=")
|
uniqueName := strings.Trim(base32.StdEncoding.EncodeToString(id[:]), "=")
|
||||||
|
|
Loading…
Reference in New Issue