mirror of https://github.com/databricks/cli.git
move more tests
This commit is contained in:
parent
55dcd1dc3a
commit
09975a02ef
|
@ -1,22 +0,0 @@
|
|||
bundle:
|
||||
name: test
|
||||
|
||||
workspace:
|
||||
profile: test
|
||||
|
||||
resources:
|
||||
jobs:
|
||||
foo:
|
||||
name: job foo
|
||||
bar:
|
||||
name: job bar
|
||||
pipelines:
|
||||
zab:
|
||||
name: pipeline foo
|
||||
baz:
|
||||
name: pipeline baz
|
||||
experiments:
|
||||
zaz:
|
||||
name: experiment zaz
|
||||
zuz:
|
||||
name: experiment zuz
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/databricks/cli/bundle/deploy/metadata"
|
||||
"github.com/databricks/cli/bundle/deploy/terraform"
|
||||
"github.com/databricks/cli/bundle/permissions"
|
||||
"github.com/databricks/cli/bundle/python"
|
||||
"github.com/databricks/cli/bundle/scripts"
|
||||
)
|
||||
|
||||
|
@ -42,7 +43,7 @@ func Initialize() bundle.Mutator {
|
|||
mutator.DefaultQueueing(),
|
||||
mutator.ExpandPipelineGlobPaths(),
|
||||
mutator.TranslatePaths(),
|
||||
// python.WrapperWarning(),
|
||||
python.WrapperWarning(),
|
||||
permissions.ApplyBundlePermissions(),
|
||||
permissions.FilterCurrentUser(),
|
||||
metadata.AnnotateJobs(),
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
bundle:
|
||||
name: test
|
||||
|
||||
workspace:
|
||||
profile: test
|
||||
|
||||
resources:
|
||||
jobs:
|
||||
foo:
|
||||
name: job foo
|
||||
pipelines:
|
||||
foo:
|
||||
name: pipeline foo
|
|
@ -1,13 +0,0 @@
|
|||
bundle:
|
||||
name: test
|
||||
|
||||
workspace:
|
||||
profile: test
|
||||
|
||||
include:
|
||||
- "*.yml"
|
||||
|
||||
resources:
|
||||
jobs:
|
||||
foo:
|
||||
name: job foo
|
|
@ -1,4 +0,0 @@
|
|||
resources:
|
||||
pipelines:
|
||||
foo:
|
||||
name: pipeline foo
|
|
@ -1,42 +0,0 @@
|
|||
package config_tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/phases"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestConflictingResourceIdsNoSubconfig(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
b, err := bundle.Load(ctx, "./conflicting_resource_ids/no_subconfigurations")
|
||||
require.NoError(t, err)
|
||||
diags := bundle.Apply(ctx, b, phases.Load())
|
||||
bundleConfigPath := filepath.FromSlash("conflicting_resource_ids/no_subconfigurations/databricks.yml")
|
||||
assert.ErrorContains(t, diags.Error(), fmt.Sprintf("multiple resources named foo (job at %s:10:7, pipeline at %s:13:7)", bundleConfigPath, bundleConfigPath))
|
||||
}
|
||||
|
||||
func TestConflictingResourceIdsOneSubconfig(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
b, err := bundle.Load(ctx, "./conflicting_resource_ids/one_subconfiguration")
|
||||
require.NoError(t, err)
|
||||
diags := bundle.Apply(ctx, b, phases.Load())
|
||||
bundleConfigPath := filepath.FromSlash("conflicting_resource_ids/one_subconfiguration/databricks.yml")
|
||||
resourcesConfigPath := filepath.FromSlash("conflicting_resource_ids/one_subconfiguration/resources.yml")
|
||||
assert.ErrorContains(t, diags.Error(), fmt.Sprintf("multiple resources named foo (job at %s:13:7, pipeline at %s:4:7)", bundleConfigPath, resourcesConfigPath))
|
||||
}
|
||||
|
||||
func TestConflictingResourceIdsTwoSubconfigs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
b, err := bundle.Load(ctx, "./conflicting_resource_ids/two_subconfigurations")
|
||||
require.NoError(t, err)
|
||||
diags := bundle.Apply(ctx, b, phases.Load())
|
||||
resources1ConfigPath := filepath.FromSlash("conflicting_resource_ids/two_subconfigurations/resources1.yml")
|
||||
resources2ConfigPath := filepath.FromSlash("conflicting_resource_ids/two_subconfigurations/resources2.yml")
|
||||
assert.ErrorContains(t, diags.Error(), fmt.Sprintf("multiple resources named foo (job at %s:4:7, pipeline at %s:4:7)", resources1ConfigPath, resources2ConfigPath))
|
||||
}
|
|
@ -30,6 +30,10 @@ func TestValidateUniqueResourceIdentifiers(t *testing.T) {
|
|||
// name: "duplicate_resource_name_in_subconfiguration_job_and_job",
|
||||
// errorMsg: "multiple resources named foo (jobs.foo at validate/duplicate_resource_name_in_subconfiguration_job_and_job/databricks.yml:10:7, jobs.foo at validate/duplicate_resource_name_in_subconfiguration_job_and_job/resources.yml:4:7)",
|
||||
// },
|
||||
{
|
||||
name: "duplicate_resource_names_in_different_subconfiguations",
|
||||
errorMsg: "multiple resources named foo (jobs.foo at validate/duplicate_resource_names_in_different_subconfiguations/resources1.yml:4:7, pipelines.foo at validate/duplicate_resource_names_in_different_subconfiguations/resources2.yml:4:7)",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tcases {
|
||||
|
|
Loading…
Reference in New Issue