Fixed an apps message order and added output test (#2174)

## Changes
Fixed an apps message order and added output test
This commit is contained in:
Andrew Nester 2025-01-17 15:42:39 +01:00 committed by GitHub
parent 560c3d352e
commit 0c088d4050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 2 deletions

View File

@ -130,13 +130,13 @@ func Deploy(outputHandler sync.OutputHandler) bundle.Mutator {
// mutators need informed consent if they are potentially destructive.
deployCore := bundle.Defer(
bundle.Seq(
apps.SlowDeployMessage(),
bundle.LogString("Deploying resources..."),
terraform.Apply(),
),
bundle.Seq(
terraform.StatePush(),
terraform.Load(),
apps.SlowDeployMessage(),
apps.InterpolateVariables(),
apps.UploadConfig(),
metadata.Compute(),

View File

@ -6,8 +6,10 @@ import (
"testing"
"github.com/databricks/cli/integration/internal/acc"
"github.com/databricks/cli/internal/testcli"
"github.com/databricks/cli/internal/testutil"
"github.com/databricks/cli/libs/env"
"github.com/databricks/cli/libs/testdiff"
"github.com/databricks/databricks-sdk-go/service/apps"
"github.com/google/uuid"
"github.com/stretchr/testify/require"
@ -49,7 +51,31 @@ func TestDeployBundleWithApp(t *testing.T) {
}
})
deployBundle(t, ctx, root)
ctx, replacements := testdiff.WithReplacementsMap(ctx)
replacements.Set(uniqueId, "$UNIQUE_PRJ")
user, err := wt.W.CurrentUser.Me(ctx)
require.NoError(t, err)
require.NotNil(t, user)
testdiff.PrepareReplacementsUser(t, replacements, *user)
testdiff.PrepareReplacementsWorkspaceClient(t, replacements, wt.W)
testdiff.PrepareReplacementsUUID(t, replacements)
testdiff.PrepareReplacementsNumber(t, replacements)
testdiff.PrepareReplacementsTemporaryDirectory(t, replacements)
testutil.Chdir(t, root)
testcli.AssertOutput(
t,
ctx,
[]string{"bundle", "validate"},
testutil.TestData("testdata/apps/bundle_validate.txt"),
)
testcli.AssertOutput(
t,
ctx,
[]string{"bundle", "deploy", "--force-lock", "--auto-approve"},
testutil.TestData("testdata/apps/bundle_deploy.txt"),
)
// App should exists after bundle deployment
app, err := wt.W.Apps.Get(ctx, apps.GetAppRequest{Name: appId})

View File

@ -0,0 +1,5 @@
Uploading bundle files to /Workspace/Users/$USERNAME/.bundle/$UNIQUE_PRJ/files...
Note: Databricks apps included in this bundle may increase initial deployment time due to compute provisioning.
Deploying resources...
Updating deployment state...
Deployment complete!

View File

@ -0,0 +1,7 @@
Name: basic
Target: default
Workspace:
User: $USERNAME
Path: /Workspace/Users/$USERNAME/.bundle/$UNIQUE_PRJ
Validation OK!