From 12259b9837e9ef933755dcb2817540e5b8df19a6 Mon Sep 17 00:00:00 2001 From: Wojciech Pratkowiecki Date: Wed, 2 Oct 2024 20:08:31 +0200 Subject: [PATCH] Add test --- internal/bundle/deploy_test.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/bundle/deploy_test.go b/internal/bundle/deploy_test.go index e1eff60d..923cd633 100644 --- a/internal/bundle/deploy_test.go +++ b/internal/bundle/deploy_test.go @@ -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") } -func TestAccBundleDeployUcSchemaDryRun(t *testing.T) { +func TestAccBundleDeployUcSchemaIsNotAppliedWhenDryRun(t *testing.T) { ctx, wt := acc.UcWorkspaceTest(t) w := wt.W @@ -141,18 +141,17 @@ func TestAccBundleDeployUcSchemaDryRun(t *testing.T) { err := os.Remove(filepath.Join(bundleRoot, "schema.yml")) require.NoError(t, err) - // Redeploy the bundle + // Run dry-run for the bundle deployment t.Setenv("BUNDLE_ROOT", bundleRoot) 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() + 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}, ".")) - apiErr := &apierr.APIError{} + require.NoError(t, err) 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) { @@ -264,7 +263,7 @@ func TestAccDeployBasicBundleLogs(t *testing.T) { stdout, stderr := blackBoxRun(t, root, "bundle", "deploy") 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...", "Updating deployment state...", "Deployment complete!\n",