mirror of https://github.com/databricks/cli.git
Add test
This commit is contained in:
parent
a64b88b93c
commit
12259b9837
|
@ -127,7 +127,7 @@ func TestAccBundleDeployUcSchemaFailsWithoutAutoApprove(t *testing.T) {
|
||||||
assert.Contains(t, stdout.String(), "the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed")
|
assert.Contains(t, stdout.String(), "the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccBundleDeployUcSchemaDryRun(t *testing.T) {
|
func TestAccBundleDeployUcSchemaIsNotAppliedWhenDryRun(t *testing.T) {
|
||||||
ctx, wt := acc.UcWorkspaceTest(t)
|
ctx, wt := acc.UcWorkspaceTest(t)
|
||||||
w := wt.W
|
w := wt.W
|
||||||
|
|
||||||
|
@ -141,18 +141,17 @@ func TestAccBundleDeployUcSchemaDryRun(t *testing.T) {
|
||||||
err := os.Remove(filepath.Join(bundleRoot, "schema.yml"))
|
err := os.Remove(filepath.Join(bundleRoot, "schema.yml"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Redeploy the bundle
|
// Run dry-run for the bundle deployment
|
||||||
t.Setenv("BUNDLE_ROOT", bundleRoot)
|
t.Setenv("BUNDLE_ROOT", bundleRoot)
|
||||||
t.Setenv("TERM", "dumb")
|
t.Setenv("TERM", "dumb")
|
||||||
c := internal.NewCobraTestRunnerWithContext(t, ctx, "bundle", "deploy", "--dry0run")
|
c := internal.NewCobraTestRunnerWithContext(t, ctx, "bundle", "deploy", "--dry-run")
|
||||||
stdout, _, err := c.Run()
|
stdout, _, err := c.Run()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Assert the schema is deleted
|
// Assert the schema was not deleted
|
||||||
_, err = w.Schemas.GetByFullName(ctx, strings.Join([]string{catalogName, schemaName}, "."))
|
_, err = w.Schemas.GetByFullName(ctx, strings.Join([]string{catalogName, schemaName}, "."))
|
||||||
apiErr := &apierr.APIError{}
|
require.NoError(t, err)
|
||||||
assert.Contains(t, stdout.String(), "Following changes would be deployed:")
|
assert.Contains(t, stdout.String(), "Following changes would be deployed:")
|
||||||
assert.True(t, errors.As(err, &apiErr))
|
|
||||||
assert.Equal(t, "SCHEMA_DOES_NOT_EXIST", apiErr.ErrorCode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccBundlePipelineDeleteWithoutAutoApprove(t *testing.T) {
|
func TestAccBundlePipelineDeleteWithoutAutoApprove(t *testing.T) {
|
||||||
|
@ -264,7 +263,7 @@ func TestAccDeployBasicBundleLogs(t *testing.T) {
|
||||||
|
|
||||||
stdout, stderr := blackBoxRun(t, root, "bundle", "deploy")
|
stdout, stderr := blackBoxRun(t, root, "bundle", "deploy")
|
||||||
assert.Equal(t, strings.Join([]string{
|
assert.Equal(t, strings.Join([]string{
|
||||||
fmt.Sprintf("Uploading bundle files to /Users/%s/.bundle/%s/files...", currentUser.UserName, uniqueId),
|
fmt.Sprintf("Uploading bundle files to /Workspace/Users/%s/.bundle/%s/files...", currentUser.UserName, uniqueId),
|
||||||
"Deploying resources...",
|
"Deploying resources...",
|
||||||
"Updating deployment state...",
|
"Updating deployment state...",
|
||||||
"Deployment complete!\n",
|
"Deployment complete!\n",
|
||||||
|
|
Loading…
Reference in New Issue