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

e2e: add test helper struct for contrast subcommands #268

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

burgerdev
Copy link
Contributor

This chain of commits adds a test helper struct that holds state for an e2e test and deals with executing contrast subcommands. It currently starts from the content created by just populate, but should be fed with kuberesources once we can patch images from Go.

The idea of ContrastTest is to be invoked from e2e tests with as little ceremony as possible, which is why it takes *testing.T args everywhere. It should also provide high-level APIs to the outcomes of the contrast commands it runs (an initial example of these are MeshCACert() and RootCACert(), an obvious next step is access to manifests).

The methods currently don't allow to customize the calls, but will eventually need to (we will want to call Set() more than once to verify owner authentication, for example). We can think about introducing new functions for that, SetWithArgs() or something, but the current implementation is sufficient for testing the simple workflow and our example deployments, so I'd only add that when needed.

@burgerdev burgerdev added the no changelog PRs not listed in the release notes label Mar 20, 2024
@burgerdev burgerdev requested a review from malt3 March 20, 2024 14:05
@burgerdev burgerdev requested a review from katexochen as a code owner March 20, 2024 14:05
Copy link
Contributor

@malt3 malt3 left a comment

Choose a reason for hiding this comment

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

I like the test helpers. LGTM.

Copy link
Member

@katexochen katexochen left a comment

Choose a reason for hiding this comment

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

lgtm, just some nits.

e2e/internal/contrasttest/contrasttest.go Outdated Show resolved Hide resolved
e2e/internal/contrasttest/contrasttest.go Outdated Show resolved Hide resolved
.github/workflows/e2e_openssl.yml Show resolved Hide resolved
@burgerdev burgerdev force-pushed the burgerdev/e2e-lib branch from a9dda95 to 8bae2ca Compare April 8, 2024 12:45
@burgerdev burgerdev force-pushed the burgerdev/e2e-lib branch from 8bae2ca to 31baac3 Compare April 8, 2024 13:25
@burgerdev burgerdev merged commit 5119c52 into main Apr 10, 2024
7 checks passed
@burgerdev burgerdev deleted the burgerdev/e2e-lib branch April 10, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants