databricks-cli/cmd
Pieter Noordhuis 70b7bbfd81
Remove calls to `t.Setenv` from integration tests (#2018)
## Changes

The `Setenv` helper function configures an environment variable and
resets it to its original value when exiting the test scope. It is
incompatible with running tests in parallel because it modifies
process-wide state. The `libs/env` package defines functions to interact
with the environment but records `Setenv` calls on a `context.Context`.
This enables us to override/specialize the environment scoped to a
context.

Pre-requisites for removing the `t.Setenv` calls:
* Make `cmdio.NewIO` accept a context and use it with `libs/env`
* Make all `internal/testcli` functions use a context

The rest of this change:
* Modifies integration tests to initialize a context to use if there
wasn't already one
* Updates `t.Setenv` calls to use `env.Set`

## Tests

n/a
2024-12-16 12:34:37 +01:00
..
account Bump github.com/databricks/databricks-sdk-go from 0.51.0 to 0.52.0 (#1931) 2024-11-28 15:33:51 +00:00
api Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
auth Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
bundle Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
configure Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
fs Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
labs Remove calls to `t.Setenv` from integration tests (#2018) 2024-12-16 12:34:37 +01:00
root Remove calls to `t.Setenv` from integration tests (#2018) 2024-12-16 12:34:37 +01:00
sync Enable gofumpt and goimports in golangci-lint (#1999) 2024-12-12 10:28:42 +01:00
version Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
workspace Bump github.com/databricks/databricks-sdk-go from 0.52.0 to 0.53.0 (#1985) 2024-12-12 14:36:00 +00:00
cmd.go Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00