Skip to content

chore: parameterize SubCommandTest with configLevel - #239

Merged
zeroshade merged 27 commits into
columnar-tech:mainfrom
amoeba:chore/support-full-integration-tests-take-two
Jan 5, 2026
Merged

zeroshade merged 27 commits into
columnar-tech:mainfrom
amoeba:chore/support-full-integration-tests-take-two

Conversation

@amoeba

@amoeba amoeba commented Dec 19, 2025 •

Copy link
Copy Markdown
Member

Extends the SubCommandTest test suite to be parameterized by configLevel so the subcommand tests can be run with --level set to user or system by running the test suite with DBC_TEST_LEVEL_USER=1 or DBC_TEST_LEVEL_SYSTEM=1 respectively.

This is not enabled by default on developer machines but is enabled in CI. To opt in this behavior, tests need to be written to use suite.configLevel to control their config level and tests can opt out either by not doing this or by doing this but adding appropriate Skips.

To demo what we can do now, this PR also includes a fix for #215. We could have fixed the issue by testing in a tempdir but with the change in this PR we can actually test the bug that was reported. Doing this also uncovered some edge cases in the symlink behavior so this was time well spent.

Also fixes a minor undiscovered bug in removing manifest-only drivers: e69744f.

Supersedes #238
Closes #210
Closes #215

@amoeba
amoeba marked this pull request as ready for review December 19, 2025 17:58
@amoeba
amoeba requested a review from zeroshade December 19, 2025 17:58
Comment on lines -100 to -102
func (suite *SubcommandTestSuite) TearDownTest() {
suite.Require().NoError(os.Unsetenv("ADBC_DRIVER_PATH"))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why remove this? If we're not going to remove this env var after each test, then we should move the os.Setenv to SetupSuite and add Unsetenv to TearDownSuite

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This got split out into platform specific TearDownTest methods (subcommand_unix_test.go, subcommand_windows_test.go)

Comment on lines +31 to +33
// Clean up the registry and filesystem after each test
_, user := os.LookupEnv("DBC_TEST_LEVEL_USER")
_, system := os.LookupEnv("DBC_TEST_LEVEL_SYSTEM")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what happens if both are set?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If both are set, cleanup for both should run. Does that sound right?

Comment thread config/config.go Outdated
Comment on lines +100 to +102
func GetLocation(lvl ConfigLevel) string {
return lvl.configLocation()
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not just export lvl.configLocation instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The last time you and I were looking at doing this, I think you mentioned not wanting to export lvl.configLocation so I exported a wrapper here instead. I'll remove the wrapper since I think it's fine just to export lvl.configLocation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in b7a3289. level.ConfigLocation is now exported.

Comment thread config/dirs_windows.go
return fmt.Errorf("error removing manifest %s: %w", manifest, err)
}

// TODO: Remove this when the driver managers are fixed (>=1.8.1).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is there an issue on arrow-adbc to track this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was fixed in apache/arrow-adbc@526dd93. We can file an issue here on dbc to do something about it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread cmd/dbc/subcommand_test.go Outdated

func (suite *SubcommandTestSuite) SetupTest() {
suite.tempdir = suite.T().TempDir()
suite.Require().NoError(os.Setenv("ADBC_DRIVER_PATH", suite.tempdir))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually, we could save ourselves some trouble and just use suite.T().Setenv, let's do that

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call. I didn't know about that.

I realized we can make the change more comprehensively too so I did that in 643f102.

Comment thread .github/workflows/go.yml Resolved
@amoeba
amoeba requested a review from zeroshade December 24, 2025 00:18
@amoeba

amoeba commented Dec 24, 2025

Copy link
Copy Markdown
Member Author

Thanks for the review @zeroshade. Ready for a re-review.

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks for this!

@zeroshade
zeroshade merged commit 989c1b5 into columnar-tech:main Jan 5, 2026
zeroshade pushed a commit that referenced this pull request Apr 17, 2026
Extends the SubCommandTest test suite to be parameterized by configLevel
so the subcommand tests can be run with `--level` set to user or system
by running the test suite with `DBC_TEST_LEVEL_USER=1` or
`DBC_TEST_LEVEL_SYSTEM=1` respectively.

This is not enabled by default on developer machines but is enabled in
CI. To opt in this behavior, tests need to be written to use
`suite.configLevel` to control their config level and tests can opt out
either by not doing this or by doing this but adding appropriate Skips.

To demo what we can do now, this PR also includes a fix for #215. We
could have fixed the issue by testing in a tempdir but with the change
in this PR we can actually test the bug that was reported. Doing this
also uncovered some edge cases in the symlink behavior so this was time
well spent.

Also fixes a minor undiscovered bug in removing manifest-only drivers:
506d6e0.

Supersedes #238
Closes #210 
Closes #215
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.

Driver manifest symbolic link not deleted by uninstall command Enable testing user and system level configs in ci

2 participants