databricks-cli/libs
Denis Bilenko 3f75240a56
Improve test output to include correct location (#2058)
## Changes
- Add t.Helper() in testcli-related helpers, this ensures that output is
attributed correctly to test case and not to the helper.
- Modify testlcli.Run() to run process in foreground. This is needed for
t.Helper to work.
- Extend a few assertions with message to help attribute it to proper
helper where needed.

## Tests
Manually reviewed test output.

Before:

```
+ go test --timeout 3h -v -run TestDefaultPython/3.9 ./integration/bundle/
=== RUN   TestDefaultPython
=== RUN   TestDefaultPython/3.9
    workspace.go:26: aws
    golden.go:14: run args: [bundle, init, default-python, --config-file, config.json]
    runner.go:206: [databricks stderr]:
    runner.go:206: [databricks stderr]: Welcome to the default Python template for Databricks Asset Bundles!
...
    testdiff.go:23:
                Error Trace:    /Users/denis.bilenko/work/cli/libs/testdiff/testdiff.go:23
                                                        /Users/denis.bilenko/work/cli/libs/testdiff/golden.go:43
                                                        /Users/denis.bilenko/work/cli/internal/testcli/golden.go:23
                                                        /Users/denis.bilenko/work/cli/integration/bundle/init_default_python_test.go:92
                                                        /Users/denis.bilenko/work/cli/integration/bundle/init_default_python_test.go:45
...
```

After:

```
+ go test --timeout 3h -v -run TestDefaultPython/3.9 ./integration/bundle/
=== RUN   TestDefaultPython
=== RUN   TestDefaultPython/3.9
    init_default_python_test.go:51: CLOUD_ENV=aws
    init_default_python_test.go:92:   args: bundle, init, default-python, --config-file, config.json
    init_default_python_test.go:92: stderr:
    init_default_python_test.go:92: stderr: Welcome to the default Python template for Databricks Asset Bundles!
...
    init_default_python_test.go:92:
                Error Trace:    /Users/denis.bilenko/work/cli/libs/testdiff/testdiff.go:24
                                                        /Users/denis.bilenko/work/cli/libs/testdiff/golden.go:46
                                                        /Users/denis.bilenko/work/cli/internal/testcli/golden.go:23
                                                        /Users/denis.bilenko/work/cli/integration/bundle/init_default_python_test.go:92
                                                        /Users/denis.bilenko/work/cli/integration/bundle/init_default_python_test.go:45
...
```
2025-01-02 10:49:21 +01:00
..
auth Enable errcheck everywhere and fix or silent remaining issues (#1987) 2024-12-11 13:26:00 +01:00
cmdgroup Add error checking in tests and enable errcheck there (#1980) 2024-12-09 13:56:41 +01:00
cmdio Remove calls to `t.Setenv` from integration tests (#2018) 2024-12-16 12:34:37 +01:00
databrickscfg Remove calls to `t.Setenv` from integration tests (#2018) 2024-12-16 12:34:37 +01:00
dbr Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
diag Properly read Git metadata when running inside workspace (#1945) 2024-12-05 10:13:13 +00:00
dyn Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
env Enable errcheck everywhere and fix or silent remaining issues (#1987) 2024-12-11 13:26:00 +01:00
errs Rewrite 'interface{} -> any' (#1959) 2024-12-05 15:37:24 +00:00
exec Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
fakefs Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
filer Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
fileset Make fileset take optional list of paths to list (#1684) 2024-08-19 15:15:14 +00:00
flags Remove dependency on ghodss/yaml (#2032) 2024-12-19 08:23:05 +00:00
folders Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
git Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
iamutil Move utility functions dealing with IAM to libs/iamutil (#1820) 2024-10-10 13:02:25 +00:00
jsonschema Custom annotations for bundle-specific JSON schema fields (#1957) 2024-12-18 10:19:14 +00:00
locker Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
log Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
notebook Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
process Enable errcheck everywhere and fix or silent remaining issues (#1987) 2024-12-11 13:26:00 +01:00
python Fix finding Python within virtualenv on Windows (#2034) 2024-12-20 07:45:32 +00:00
set Show actionable errors for collaborative deployment scenarios (#1386) 2024-10-10 11:18:23 +00:00
sync Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
tags Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
template Relax checks in builtin template tests (#2042) 2024-12-27 11:38:12 +00:00
terraform Move to a single prompt during bundle destroy (#1583) 2024-07-24 13:02:19 +00:00
testdiff Improve test output to include correct location (#2058) 2025-01-02 10:49:21 +01:00
testfile Refactor and cover edge cases in sync integration tests (#160) 2023-01-10 13:16:30 +01:00
textutil Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
vfs Switch to `folders.FindDirWithLeaf` (#1963) 2024-12-11 09:44:22 +01:00