Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor autocert test setup to be clearer #5100

Open
kenjenkins opened this issue May 2, 2024 · 0 comments
Open

Refactor autocert test setup to be clearer #5100

kenjenkins opened this issue May 2, 2024 · 0 comments

Comments

@kenjenkins
Copy link
Contributor

A few of the autocert tests are structured in an unconventional way, using a map[string]func(t *testing.T) test:

I think the intention is to allow particular tests to run some initialization steps before some shared test case logic, but I find the implementation confusing, especially how the loop body contains:

tc := run(t)
t.Run(name, func(t *testing.T) {

The first run() call does not run the test, but instead the (optional) initialization steps. I think we could make it clearer what's going on by renaming/refactoring some of this setup logic.

In addition, by running the initialization in the main test (instead of inside the sub-test), a failure of the initialization steps in one test case may prevent the remaining test cases from running.

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

No branches or pull requests

1 participant