mirror of https://github.com/databricks/cli.git
fixed test
This commit is contained in:
parent
f135ecc799
commit
cfcb787fbc
|
@ -37,6 +37,8 @@ func Initialize() bundle.Mutator {
|
||||||
mutator.MergeJobParameters(),
|
mutator.MergeJobParameters(),
|
||||||
mutator.MergeJobTasks(),
|
mutator.MergeJobTasks(),
|
||||||
mutator.MergePipelineClusters(),
|
mutator.MergePipelineClusters(),
|
||||||
|
mutator.MergeApps(),
|
||||||
|
|
||||||
mutator.InitializeWorkspaceClient(),
|
mutator.InitializeWorkspaceClient(),
|
||||||
mutator.PopulateCurrentUser(),
|
mutator.PopulateCurrentUser(),
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ variables:
|
||||||
env:
|
env:
|
||||||
- name: SOME_ENV_VARIABLE
|
- name: SOME_ENV_VARIABLE
|
||||||
value: "Some value"
|
value: "Some value"
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
apps:
|
apps:
|
||||||
my_app:
|
my_app:
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package config_tests
|
package config_tests
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/databricks/cli/bundle"
|
||||||
|
"github.com/databricks/cli/bundle/config/mutator"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,6 +13,13 @@ func TestApps(t *testing.T) {
|
||||||
b := load(t, "./apps")
|
b := load(t, "./apps")
|
||||||
assert.Equal(t, "apps", b.Config.Bundle.Name)
|
assert.Equal(t, "apps", b.Config.Bundle.Name)
|
||||||
|
|
||||||
|
diags := bundle.Apply(context.Background(), b,
|
||||||
|
bundle.Seq(
|
||||||
|
mutator.SetVariables(),
|
||||||
|
mutator.ResolveVariableReferences("variables"),
|
||||||
|
))
|
||||||
|
assert.Empty(t, diags)
|
||||||
|
|
||||||
app := b.Config.Resources.Apps["my_app"]
|
app := b.Config.Resources.Apps["my_app"]
|
||||||
assert.Equal(t, "my-app", app.Name)
|
assert.Equal(t, "my-app", app.Name)
|
||||||
assert.Equal(t, "My App", app.Description)
|
assert.Equal(t, "My App", app.Description)
|
||||||
|
@ -27,6 +37,12 @@ func TestAppsOverride(t *testing.T) {
|
||||||
b := loadTarget(t, "./apps", "development")
|
b := loadTarget(t, "./apps", "development")
|
||||||
assert.Equal(t, "apps", b.Config.Bundle.Name)
|
assert.Equal(t, "apps", b.Config.Bundle.Name)
|
||||||
|
|
||||||
|
diags := bundle.Apply(context.Background(), b,
|
||||||
|
bundle.Seq(
|
||||||
|
mutator.SetVariables(),
|
||||||
|
mutator.ResolveVariableReferences("variables"),
|
||||||
|
))
|
||||||
|
assert.Empty(t, diags)
|
||||||
app := b.Config.Resources.Apps["my_app"]
|
app := b.Config.Resources.Apps["my_app"]
|
||||||
assert.Equal(t, "my-app", app.Name)
|
assert.Equal(t, "my-app", app.Name)
|
||||||
assert.Equal(t, "My App", app.Description)
|
assert.Equal(t, "My App", app.Description)
|
||||||
|
@ -40,6 +56,6 @@ func TestAppsOverride(t *testing.T) {
|
||||||
assert.Equal(t, "CAN_MANAGE", string(app.Resources[1].Job.Permission))
|
assert.Equal(t, "CAN_MANAGE", string(app.Resources[1].Job.Permission))
|
||||||
assert.Equal(t, "key", app.Resources[2].Secret.Key)
|
assert.Equal(t, "key", app.Resources[2].Secret.Key)
|
||||||
assert.Equal(t, "scope", app.Resources[2].Secret.Scope)
|
assert.Equal(t, "scope", app.Resources[2].Secret.Scope)
|
||||||
assert.Equal(t, "CAN_USE", string(app.Resources[2].SqlWarehouse.Permission))
|
assert.Equal(t, "CAN_USE", string(app.Resources[2].Secret.Permission))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ func loadTargetWithDiags(path, env string) (*bundle.Bundle, diag.Diagnostics) {
|
||||||
mutator.MergeJobParameters(),
|
mutator.MergeJobParameters(),
|
||||||
mutator.MergeJobTasks(),
|
mutator.MergeJobTasks(),
|
||||||
mutator.MergePipelineClusters(),
|
mutator.MergePipelineClusters(),
|
||||||
|
mutator.MergeApps(),
|
||||||
))
|
))
|
||||||
return b, diags
|
return b, diags
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue