mirror of https://github.com/databricks/cli.git
pass test
This commit is contained in:
parent
918af62827
commit
39ff2909db
|
@ -35,7 +35,7 @@ var (
|
||||||
// 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"
|
||||||
// Then install your breakpoints and click "debug test" near TestAccept in VSCODE.
|
// Then install your breakpoints and click "debug test" near TestAccept in VSCODE.
|
||||||
// example: var SingleTest = "bundle/variables/empty"
|
// example: var SingleTest = "bundle/variables/empty"
|
||||||
var SingleTest = "telemetry/dummy-without-server"
|
var SingleTest = ""
|
||||||
|
|
||||||
// If enabled, instead of compiling and running CLI externally, we'll start in-process server that accepts and runs
|
// If enabled, instead of compiling and running CLI externally, we'll start in-process server that accepts and runs
|
||||||
// CLI commands. The $CLI in test scripts is a helper that just forwards command-line arguments to this server (see bin/callserver.py).
|
// CLI commands. The $CLI in test scripts is a helper that just forwards command-line arguments to this server (see bin/callserver.py).
|
||||||
|
@ -43,8 +43,7 @@ var SingleTest = "telemetry/dummy-without-server"
|
||||||
var InprocessMode bool
|
var InprocessMode bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// flag.BoolVar(&InprocessMode, "inprocess", SingleTest != "", "Run CLI in the same process as test (for debugging)")
|
flag.BoolVar(&InprocessMode, "inprocess", SingleTest != "", "Run CLI in the same process as test (for debugging)")
|
||||||
flag.BoolVar(&InprocessMode, "inprocess", false, "Run CLI in the same process as test (for debugging)")
|
|
||||||
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)")
|
||||||
}
|
}
|
||||||
|
@ -157,7 +156,6 @@ func testAccept(t *testing.T, InprocessMode bool, singleTest string) int {
|
||||||
testdiff.PrepareReplacementsWorkspaceClient(t, &repls, workspaceClient)
|
testdiff.PrepareReplacementsWorkspaceClient(t, &repls, workspaceClient)
|
||||||
testdiff.PrepareReplacementsUUID(t, &repls)
|
testdiff.PrepareReplacementsUUID(t, &repls)
|
||||||
testdiff.PrepareReplacementsDevVersion(t, &repls)
|
testdiff.PrepareReplacementsDevVersion(t, &repls)
|
||||||
testdiff.PrepareReplaceOS(t, &repls)
|
|
||||||
|
|
||||||
testDirs := getTests(t)
|
testDirs := getTests(t)
|
||||||
require.NotEmpty(t, testDirs)
|
require.NotEmpty(t, testDirs)
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
>>> $CLI telemetry dummy
|
>>> $CLI telemetry dummy
|
||||||
|
|
||||||
|
>>> wait_file ./telemetry.pid
|
||||||
File ./telemetry.pid exists
|
File ./telemetry.pid exists
|
||||||
|
|
||||||
|
>>> wait_pid 46437
|
||||||
Process has ended
|
Process has ended
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"method":"POST","path":"/telemetry-ext","body":{"uploadTime":"UNIX_TIME_MILLIS","items":[],"protoLogs":["{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"$DEV_VERSION\",\"command\":\"telemetry_dummy\",\"operating_system\":\"[OS]\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}","{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"$DEV_VERSION\",\"command\":\"telemetry_dummy\",\"operating_system\":\"[OS]\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"]}}
|
{"method":"POST","path":"/telemetry-ext","body":{"uploadTime":"UNIX_TIME_MILLIS","items":[],"protoLogs":["{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"$DEV_VERSION\",\"command\":\"telemetry_dummy\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}","{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"$DEV_VERSION\",\"command\":\"telemetry_dummy\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"]}}
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
>>> $CLI telemetry dummy
|
>>> $CLI telemetry dummy
|
||||||
|
|
||||||
|
>>> wait_file ./telemetry.pid
|
||||||
File ./telemetry.pid exists
|
File ./telemetry.pid exists
|
||||||
|
|
||||||
|
>>> wait_pid 46711
|
||||||
Process has ended
|
Process has ended
|
||||||
|
|
|
@ -15,3 +15,7 @@ New = '"UNIX_TIME_MILLIS"'
|
||||||
[[Repls]]
|
[[Repls]]
|
||||||
Old = 'execution_time_ms\\\":\d{1,5},'
|
Old = 'execution_time_ms\\\":\d{1,5},'
|
||||||
New = 'execution_time_ms\":\"SMALL_INT\",'
|
New = 'execution_time_ms\":\"SMALL_INT\",'
|
||||||
|
|
||||||
|
[[Repls]]
|
||||||
|
Old = 'darwin|linux|windows'
|
||||||
|
New = 'OS'
|
||||||
|
|
|
@ -12,3 +12,7 @@ Response.Body = '''
|
||||||
[[Repls]]
|
[[Repls]]
|
||||||
Old = '17\d{11}'
|
Old = '17\d{11}'
|
||||||
New = '"UNIX_TIME_MILLIS"'
|
New = '"UNIX_TIME_MILLIS"'
|
||||||
|
|
||||||
|
[[Repls]]
|
||||||
|
Old = 'darwin|linux|windows'
|
||||||
|
New = 'OS'
|
||||||
|
|
|
@ -1,49 +1,17 @@
|
||||||
|
|
||||||
>>> $TERRAFORM init -no-color -get=false
|
>>> $TERRAFORM init -no-color -get=false
|
||||||
|
|
||||||
|
Error: Failed to install provider
|
||||||
|
|
||||||
|
Error while installing databricks/databricks v1.64.1: provider binary not
|
||||||
|
found: could not find executable file starting with
|
||||||
|
terraform-provider-databricks
|
||||||
|
|
||||||
|
|
||||||
Initializing the backend...
|
Initializing the backend...
|
||||||
|
|
||||||
Initializing provider plugins...
|
Initializing provider plugins...
|
||||||
- Finding databricks/databricks versions matching "1.64.1"...
|
- Finding databricks/databricks versions matching "1.64.1"...
|
||||||
- Installing databricks/databricks v1.64.1...
|
- Installing databricks/databricks v1.64.1...
|
||||||
- Installed databricks/databricks v1.64.1 (unauthenticated)
|
|
||||||
|
|
||||||
Terraform has created a lock file .terraform.lock.hcl to record the provider
|
Exit code: 1
|
||||||
selections it made above. Include this file in your version control repository
|
|
||||||
so that Terraform can guarantee to make the same selections by default when
|
|
||||||
you run "terraform init" in the future.
|
|
||||||
|
|
||||||
|
|
||||||
Warning: Incomplete lock file information for providers
|
|
||||||
|
|
||||||
Due to your customized provider installation methods, Terraform was forced to
|
|
||||||
calculate lock file checksums locally for the following providers:
|
|
||||||
- databricks/databricks
|
|
||||||
|
|
||||||
|
|
||||||
To calculate additional checksums for another platform, run:
|
|
||||||
|
|
||||||
Terraform has been successfully initialized!
|
|
||||||
|
|
||||||
You may now begin working with Terraform. Try running "terraform plan" to see
|
|
||||||
any changes that are required for your infrastructure. All Terraform commands
|
|
||||||
should now work.
|
|
||||||
|
|
||||||
If you ever set or change modules or backend configuration for Terraform,
|
|
||||||
rerun this command to reinitialize your working directory. If you forget, other
|
|
||||||
commands will detect it and remind you to do so if necessary.
|
|
||||||
|
|
||||||
>>> $TERRAFORM plan -no-color
|
|
||||||
data.databricks_current_user.me: Reading...
|
|
||||||
data.databricks_current_user.me: Read complete after (redacted) [id=$USER.Id]
|
|
||||||
|
|
||||||
Changes to Outputs:
|
|
||||||
+ username = "$USERNAME"
|
|
||||||
|
|
||||||
You can apply this plan to save these new output values to the Terraform
|
|
||||||
state, without changing any real infrastructure.
|
|
||||||
|
|
||||||
─────────────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
Note: You didn't use the -out option to save this plan, so Terraform can't
|
|
||||||
guarantee to take exactly these actions if you run "terraform apply" now.
|
|
||||||
|
|
|
@ -209,8 +209,3 @@ func PrepareReplacementsDevVersion(t testutil.TestingT, r *ReplacementsContext)
|
||||||
t.Helper()
|
t.Helper()
|
||||||
r.append(devVersionRegex, "$$DEV_VERSION")
|
r.append(devVersionRegex, "$$DEV_VERSION")
|
||||||
}
|
}
|
||||||
|
|
||||||
func PrepareReplaceOS(t testutil.TestingT, r *ReplacementsContext) {
|
|
||||||
t.Helper()
|
|
||||||
r.Set(runtime.GOOS, "[OS]")
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package testdiff
|
package testdiff
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -45,11 +44,3 @@ func TestReplacement_TemporaryDirectory(t *testing.T) {
|
||||||
|
|
||||||
assert.Equal(t, "/tmp/.../tail", repls.Replace("/tmp/foo/bar/qux/tail"))
|
assert.Equal(t, "/tmp/.../tail", repls.Replace("/tmp/foo/bar/qux/tail"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReplacement_OS(t *testing.T) {
|
|
||||||
var repls ReplacementsContext
|
|
||||||
|
|
||||||
PrepareReplaceOS(t, &repls)
|
|
||||||
|
|
||||||
assert.Equal(t, "[OS]", repls.Replace(runtime.GOOS))
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue