From 0839e6f66a344cb2bc00463b5b63d521bf2e1263 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Mon, 26 Feb 2024 11:08:03 +0100 Subject: [PATCH] Added test to verify scripts.Execute mutator works correctly (#1237) ## Changes Follow up to https://github.com/databricks/cli/pull/1232 --- bundle/scripts/scripts_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bundle/scripts/scripts_test.go b/bundle/scripts/scripts_test.go index a8835b59..bc3202e0 100644 --- a/bundle/scripts/scripts_test.go +++ b/bundle/scripts/scripts_test.go @@ -34,3 +34,18 @@ func TestExecutesHook(t *testing.T) { require.NoError(t, err) require.Equal(t, "Hello", strings.TrimSpace(line)) } + +func TestExecuteMutator(t *testing.T) { + b := &bundle.Bundle{ + Config: config.Root{ + Experimental: &config.Experimental{ + Scripts: map[config.ScriptHook]config.Command{ + config.ScriptPreBuild: "echo 'Hello'", + }, + }, + }, + } + + err := bundle.Apply(context.Background(), b, Execute(config.ScriptPreInit)) + require.NoError(t, err) +}