From c088ce358df2207950ad450ad52071489509449c Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 30 Jun 2025 09:57:31 +0200 Subject: [PATCH 1/6] Add test for crash in "bundle summary" --- .../bundle/summary/crash1/databricks.yml | 7 ++++ acceptance/bundle/summary/crash1/output.txt | 39 +++++++++++++++++++ acceptance/bundle/summary/crash1/script | 2 + acceptance/bundle/summary/crash1/test.toml | 1 + 4 files changed, 49 insertions(+) create mode 100644 acceptance/bundle/summary/crash1/databricks.yml create mode 100644 acceptance/bundle/summary/crash1/output.txt create mode 100644 acceptance/bundle/summary/crash1/script create mode 100644 acceptance/bundle/summary/crash1/test.toml diff --git a/acceptance/bundle/summary/crash1/databricks.yml b/acceptance/bundle/summary/crash1/databricks.yml new file mode 100644 index 0000000000..77a5546f4a --- /dev/null +++ b/acceptance/bundle/summary/crash1/databricks.yml @@ -0,0 +1,7 @@ +resources: + pipelines: + my_pipeline: + name: test-pipeline + libraries: + - file: + path: "./foo.py" diff --git a/acceptance/bundle/summary/crash1/output.txt b/acceptance/bundle/summary/crash1/output.txt new file mode 100644 index 0000000000..ec068c3ffe --- /dev/null +++ b/acceptance/bundle/summary/crash1/output.txt @@ -0,0 +1,39 @@ + +=== Initial view of resources without id and modified_status=created +>>> [CLI] bundle summary -o json +Error: file foo.py not found + +The Databricks CLI unexpectedly had a fatal error. +Please report this issue to Databricks in the form of a GitHub issue at: +https://github.com/databricks/cli + +CLI Version: [DEV_VERSION] + +Panic Payload: runtime error: invalid memory address or nil pointer dereference + +Stack Trace: +goroutine 1 [running]: +runtime/debug.Stack() + /opt/homebrew/Cellar/go/[GO_VERSION]/libexec/src/runtime/debug/stack.go:26 +0x64 +github.com/databricks/cli/cmd/root.Execute.func1() + /Users/denis.bilenko/work/cli/cmd/root/root.go:112 +0xa4 +panic({0x1058d1ba0?, 0x[NUMID]?}) + /opt/homebrew/Cellar/go/[GO_VERSION]/libexec/src/runtime/panic.go:792 +0x124 +github.com/databricks/cli/cmd/bundle.renderJsonOutput(0x[NUMID], 0x[NUMID]?) + /Users/denis.bilenko/work/cli/cmd/bundle/validate.go:21 +0x24 +github.com/databricks/cli/cmd/bundle.renderBundle(0x[NUMID], 0x0, {0x140000fcbd0, 0x1, 0x1}, 0x1) + /Users/denis.bilenko/work/cli/cmd/bundle/validate.go:105 +0x174 +github.com/databricks/cli/cmd/bundle.newSummaryCommand.func1(0x[NUMID], {0x140003bfc60?, 0x4?, 0x[NUMID]e?}) + /Users/denis.bilenko/work/cli/cmd/bundle/summary.go:34 +0x4c +github.com/spf13/cobra.(*Command).execute(0x[NUMID], {0x140003bfc40, 0x2, 0x2}) + /Users/denis.bilenko/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0x844 +github.com/spf13/cobra.(*Command).ExecuteC(0x140001a0c08) + /Users/denis.bilenko/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x384 +github.com/spf13/cobra.(*Command).ExecuteContextC(...) + /Users/denis.bilenko/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1080 +github.com/databricks/cli/cmd/root.Execute({0x105bbae30, 0x1066e3040}, 0x140001a0c08) + /Users/denis.bilenko/work/cli/cmd/root/root.go:141 +0x10c +main.main() + /Users/denis.bilenko/work/cli/main.go:29 +0x44 + +Exit code: 1 diff --git a/acceptance/bundle/summary/crash1/script b/acceptance/bundle/summary/crash1/script new file mode 100644 index 0000000000..65ec133dbc --- /dev/null +++ b/acceptance/bundle/summary/crash1/script @@ -0,0 +1,2 @@ +title "Initial view of resources without id and modified_status=created" +trace $CLI bundle summary -o json diff --git a/acceptance/bundle/summary/crash1/test.toml b/acceptance/bundle/summary/crash1/test.toml new file mode 100644 index 0000000000..75a69f2c1e --- /dev/null +++ b/acceptance/bundle/summary/crash1/test.toml @@ -0,0 +1 @@ +Badness = "Unexpected panic" From 47895067aa276d930757b2f116d286cc5c1d1efe Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 30 Jun 2025 10:02:45 +0200 Subject: [PATCH 2/6] clean up stacktrace --- acceptance/bundle/summary/crash1/output.txt | 31 +++++---------------- acceptance/bundle/summary/crash1/test.toml | 8 ++++++ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/acceptance/bundle/summary/crash1/output.txt b/acceptance/bundle/summary/crash1/output.txt index ec068c3ffe..0642558e1e 100644 --- a/acceptance/bundle/summary/crash1/output.txt +++ b/acceptance/bundle/summary/crash1/output.txt @@ -2,38 +2,21 @@ === Initial view of resources without id and modified_status=created >>> [CLI] bundle summary -o json Error: file foo.py not found - -The Databricks CLI unexpectedly had a fatal error. Please report this issue to Databricks in the form of a GitHub issue at: https://github.com/databricks/cli -CLI Version: [DEV_VERSION] - Panic Payload: runtime error: invalid memory address or nil pointer dereference - -Stack Trace: goroutine 1 [running]: runtime/debug.Stack() - /opt/homebrew/Cellar/go/[GO_VERSION]/libexec/src/runtime/debug/stack.go:26 +0x64 github.com/databricks/cli/cmd/root.Execute.func1() - /Users/denis.bilenko/work/cli/cmd/root/root.go:112 +0xa4 -panic({0x1058d1ba0?, 0x[NUMID]?}) - /opt/homebrew/Cellar/go/[GO_VERSION]/libexec/src/runtime/panic.go:792 +0x124 -github.com/databricks/cli/cmd/bundle.renderJsonOutput(0x[NUMID], 0x[NUMID]?) - /Users/denis.bilenko/work/cli/cmd/bundle/validate.go:21 +0x24 -github.com/databricks/cli/cmd/bundle.renderBundle(0x[NUMID], 0x0, {0x140000fcbd0, 0x1, 0x1}, 0x1) - /Users/denis.bilenko/work/cli/cmd/bundle/validate.go:105 +0x174 -github.com/databricks/cli/cmd/bundle.newSummaryCommand.func1(0x[NUMID], {0x140003bfc60?, 0x4?, 0x[NUMID]e?}) - /Users/denis.bilenko/work/cli/cmd/bundle/summary.go:34 +0x4c -github.com/spf13/cobra.(*Command).execute(0x[NUMID], {0x140003bfc40, 0x2, 0x2}) - /Users/denis.bilenko/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0x844 -github.com/spf13/cobra.(*Command).ExecuteC(0x140001a0c08) - /Users/denis.bilenko/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x384 +panic({HEX?, HEX?}) +github.com/databricks/cli/cmd/bundle.renderJsonOutput(HEX, HEX?) +github.com/databricks/cli/cmd/bundle.renderBundle(HEX, HEX, {HEX, HEX, HEX}, HEX) +github.com/databricks/cli/cmd/bundle.newSummaryCommand.func1(HEX, {HEX?, HEX?, HEX?}) +github.com/spf13/cobra.(*Command).execute(HEX, {HEX, HEX, HEX}) +github.com/spf13/cobra.(*Command).ExecuteC(HEX) github.com/spf13/cobra.(*Command).ExecuteContextC(...) - /Users/denis.bilenko/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1080 -github.com/databricks/cli/cmd/root.Execute({0x105bbae30, 0x1066e3040}, 0x140001a0c08) - /Users/denis.bilenko/work/cli/cmd/root/root.go:141 +0x10c +github.com/databricks/cli/cmd/root.Execute({HEX, HEX}, HEX) main.main() - /Users/denis.bilenko/work/cli/main.go:29 +0x44 Exit code: 1 diff --git a/acceptance/bundle/summary/crash1/test.toml b/acceptance/bundle/summary/crash1/test.toml index 75a69f2c1e..86680c4e9f 100644 --- a/acceptance/bundle/summary/crash1/test.toml +++ b/acceptance/bundle/summary/crash1/test.toml @@ -1 +1,9 @@ Badness = "Unexpected panic" + +[[Repls]] +Old = '0x[0-9a-f]{1,}' +New = 'HEX' + +[[Repls]] +Old = '\n\s+.*\n' +New = "\n" From 2385a20a3058362c57f9973e81dbf5514446b546 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 30 Jun 2025 10:04:01 +0200 Subject: [PATCH 3/6] rename test --- .../{crash1 => missing-libraries-file-path}/databricks.yml | 0 .../summary/{crash1 => missing-libraries-file-path}/output.txt | 0 .../bundle/summary/{crash1 => missing-libraries-file-path}/script | 0 .../summary/{crash1 => missing-libraries-file-path}/test.toml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename acceptance/bundle/summary/{crash1 => missing-libraries-file-path}/databricks.yml (100%) rename acceptance/bundle/summary/{crash1 => missing-libraries-file-path}/output.txt (100%) rename acceptance/bundle/summary/{crash1 => missing-libraries-file-path}/script (100%) rename acceptance/bundle/summary/{crash1 => missing-libraries-file-path}/test.toml (100%) diff --git a/acceptance/bundle/summary/crash1/databricks.yml b/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml similarity index 100% rename from acceptance/bundle/summary/crash1/databricks.yml rename to acceptance/bundle/summary/missing-libraries-file-path/databricks.yml diff --git a/acceptance/bundle/summary/crash1/output.txt b/acceptance/bundle/summary/missing-libraries-file-path/output.txt similarity index 100% rename from acceptance/bundle/summary/crash1/output.txt rename to acceptance/bundle/summary/missing-libraries-file-path/output.txt diff --git a/acceptance/bundle/summary/crash1/script b/acceptance/bundle/summary/missing-libraries-file-path/script similarity index 100% rename from acceptance/bundle/summary/crash1/script rename to acceptance/bundle/summary/missing-libraries-file-path/script diff --git a/acceptance/bundle/summary/crash1/test.toml b/acceptance/bundle/summary/missing-libraries-file-path/test.toml similarity index 100% rename from acceptance/bundle/summary/crash1/test.toml rename to acceptance/bundle/summary/missing-libraries-file-path/test.toml From cf930385fb6e744aea9b9e3ae7dabf637e0f0323 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 30 Jun 2025 10:04:12 +0200 Subject: [PATCH 4/6] add a comment --- .../bundle/summary/missing-libraries-file-path/databricks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml b/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml index 77a5546f4a..95a19ac58b 100644 --- a/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml +++ b/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml @@ -4,4 +4,5 @@ resources: name: test-pipeline libraries: - file: + # missing on purpose path: "./foo.py" From 8793e585f7c2cec4c624e4648c73624573b9ee4c Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 30 Jun 2025 10:04:40 +0200 Subject: [PATCH 5/6] descriptive file name --- .../bundle/summary/missing-libraries-file-path/databricks.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml b/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml index 95a19ac58b..2b9ded495b 100644 --- a/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml +++ b/acceptance/bundle/summary/missing-libraries-file-path/databricks.yml @@ -4,5 +4,4 @@ resources: name: test-pipeline libraries: - file: - # missing on purpose - path: "./foo.py" + path: "./intentionally-missing.py" From ec55b94b3bbe54340eabd906f5c86547b6e99123 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 30 Jun 2025 10:26:12 +0200 Subject: [PATCH 6/6] update output --- .../bundle/summary/missing-libraries-file-path/output.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/bundle/summary/missing-libraries-file-path/output.txt b/acceptance/bundle/summary/missing-libraries-file-path/output.txt index 0642558e1e..4dd3d4cae2 100644 --- a/acceptance/bundle/summary/missing-libraries-file-path/output.txt +++ b/acceptance/bundle/summary/missing-libraries-file-path/output.txt @@ -1,7 +1,7 @@ === Initial view of resources without id and modified_status=created >>> [CLI] bundle summary -o json -Error: file foo.py not found +Error: file intentionally-missing.py not found Please report this issue to Databricks in the form of a GitHub issue at: https://github.com/databricks/cli