Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptance/bin/contains.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
found.add(t)
for t in must_not_find:
if t in line:
sys.stderr.write(f"contains error: {t!r} was not expected\n")
sys.stderr.write(f"contains error: {t!r} was not expected: {line.strip()!r}\n")

sys.stdout.flush()

Expand Down
8 changes: 4 additions & 4 deletions acceptance/bundle/invariant/migrate/script
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cp databricks.yml LOG.config

cleanup() {
trace $CLI bundle destroy --auto-approve &> LOG.destroy
cat LOG.destroy | contains.py '!panic' '!internal error' > /dev/null
cat LOG.destroy | contains.py '!panic:' '!internal error' > /dev/null

# Run cleanup script if present
CLEANUP_SCRIPT="$TESTDIR/../configs/$INPUT_CONFIG-cleanup.sh"
Expand All @@ -30,14 +30,14 @@ cleanup() {
trap cleanup EXIT

trace DATABRICKS_BUNDLE_ENGINE=terraform $CLI bundle deploy &> LOG.deploy
cat LOG.deploy | contains.py '!panic' '!internal error' > /dev/null
cat LOG.deploy | contains.py '!panic:' '!internal error' > /dev/null

echo INPUT_CONFIG_OK

trace $CLI bundle deployment migrate &> LOG.migrate

cat LOG.migrate | contains.py '!panic' '!internal error' > /dev/null
cat LOG.migrate | contains.py '!panic:' '!internal error' > /dev/null

$CLI bundle plan -o json &> plan.json
cat plan.json | contains.py '!panic' '!internal error' > /dev/null
cat plan.json | contains.py '!panic:' '!internal error' > /dev/null
verify_no_drift.py plan.json
2 changes: 1 addition & 1 deletion acceptance/selftest/contains/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Failed script
=== This should complain about Hello present in output
>>> python3 ./success.py
Hello world
contains error: 'Hello' was not expected
contains error: 'Hello' was not expected: 'Hello world'

=== This should not complain
>>> python3 ./success.py
Expand Down
10 changes: 8 additions & 2 deletions bundle/direct/dresources/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ var (
globalConfig *Config
generatedConfigOnce sync.Once
generatedConfig *Config
empty = ResourceLifecycleConfig{
IgnoreRemoteChanges: nil,
IgnoreLocalChanges: nil,
RecreateOnChanges: nil,
UpdateIDOnChanges: nil,
}
)

// MustLoadConfig loads and parses the embedded resources.yml configuration.
Expand Down Expand Up @@ -78,7 +84,7 @@ func GetResourceConfig(resourceType string) *ResourceLifecycleConfig {
if rc, ok := cfg.Resources[resourceType]; ok {
return &rc
}
return nil
return &empty
}

// GetGeneratedResourceConfig returns the generated lifecycle config for a given resource type.
Expand All @@ -88,5 +94,5 @@ func GetGeneratedResourceConfig(resourceType string) *ResourceLifecycleConfig {
if rc, ok := cfg.Resources[resourceType]; ok {
return &rc
}
return nil
return &empty
}
4 changes: 2 additions & 2 deletions bundle/direct/dresources/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ func TestMustLoadConfig(t *testing.T) {
}

func TestGetResourceConfig(t *testing.T) {
assert.NotNil(t, GetResourceConfig("volumes"))
assert.Nil(t, GetResourceConfig("nonexistent"))
assert.NotEmpty(t, GetResourceConfig("volumes").RecreateOnChanges)
assert.Empty(t, GetResourceConfig("nonexistent").RecreateOnChanges)
}