Skip to content

Remove testify from config/config_test.go#1511

Open
renaudhartert-db wants to merge 6 commits intomainfrom
remove-testify-config-test
Open

Remove testify from config/config_test.go#1511
renaudhartert-db wants to merge 6 commits intomainfrom
remove-testify-config-test

Conversation

@renaudhartert-db
Copy link
Contributor

@renaudhartert-db renaudhartert-db commented Mar 2, 2026

Summary

Removes testify/assert and testify/require from config/config_test.go,
replacing them with standard library assertions and google/go-cmp.

Why

The project convention discourages testify in new and updated test code to
minimize third-party dependencies. config/config_test.go was one of the
files still importing testify. This PR brings it in line with the preferred
style already used in the second half of the file and in newer test files.

What changed

Interface changes

None.

Behavioral changes

None — pure test refactor.

Internal changes

  • Consolidated four separate TestHostType_* functions into one table-driven
    TestConfig_HostType with four cases.
  • Replaced assert.Equal/assert.NoError/require.NoError with
    if got != want { t.Errorf(...) } and if err != nil { t.Fatalf(...) }.
  • Replaced assert.ErrorIs with errors.Is.
  • Replaced assert.Panics with defer/recover.
  • Replaced assert.True/assert.False with plain if checks.
  • Used cmp.Diff for OAuthAuthorizationServer struct comparisons.
  • Removed testify/assert and testify/require imports; added errors.

How is this tested?

All 21 tests in config/config_test.go pass locally via go test ./config/ -v.

NO_CHANGELOG=true

Replace testify/assert and testify/require with standard library
assertions and google/go-cmp, consistent with the project's goal of
minimizing third-party dependencies in new and updated test code.

- Consolidate four separate TestHostType_* functions into one
  table-driven TestConfig_HostType
- Convert assert.Equal/NoError/True/False/ErrorIs/Panics to
  stdlib equivalents (t.Errorf, t.Fatalf, errors.Is, defer/recover)
- Use cmp.Diff for struct comparisons (OAuthAuthorizationServer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ubuntu <renaud.hartert@databricks.com>
Copy link
Member

@simonfaltum simonfaltum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a clean migration, thanks for doing this

The merge from main dropped the "AWS account without scheme" and
"AWS DoD account without scheme" test cases from the TestConfig_HostType
table. These were originally added in #1510 and cover schemeless host
values in .databrickscfg profiles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ubuntu <renaud.hartert@databricks.com>
@github-actions
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1511
  • Commit SHA: 77312d5d69f550f5133032305a902c89e28bf8cd

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants