Skip to content
New issue

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

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

Already on GitHub? # to your account

[e2e] Abstract usage of ginkgo with a new test context #3254

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

marun
Copy link
Contributor

@marun marun commented Jul 31, 2024

Why this should be merged

Reuse of e2e tests and tooling requires removing direct dependency on ginkgo. This PR adds a new TestContext type that must be explicitly used to access the global ginkgo functions. This enables reuse of tmpnet glue code for #3215 (adds tmpnet support for antithesis workloads).

Next steps will include ensuring a consistent interface for test invocation to allow reuse of e2e tests in non-ginkgo environments.

How this works

  • add new TestContext interface
  • provide GinkgoTestContext implementation backed by ginkgo's global functions
  • update all tests and helpers to use the new test context in place of ginkgo's globals
  • ???
  • profit!

How this was tested

CI

@marun marun added the testing This primarily focuses on testing label Jul 31, 2024
@marun marun self-assigned this Jul 31, 2024
@marun marun force-pushed the e2e-test-context branch 3 times, most recently from 9f301eb to 99294e5 Compare July 31, 2024 06:01
@marun marun marked this pull request as ready for review July 31, 2024 06:05
@marun marun requested a review from abi87 as a code owner July 31, 2024 06:05
@marun marun force-pushed the e2e-test-context branch from 99294e5 to 4945ee2 Compare July 31, 2024 06:13
Comment on lines +22 to +24
func NewTestContext() *GinkgoTestContext {
return &GinkgoTestContext{}
}
Copy link
Collaborator

@aaronbuchwald aaronbuchwald Jul 31, 2024

Choose a reason for hiding this comment

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

Why not embed ginkgo.GinkgoT() and possibly require.New(t) here to cut out some of the wrapper code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by embed? The TestContext interface does embed require.TestingT. Or are you thinking the context type should have a method to return a require instance?

@marun marun force-pushed the e2e-test-context branch from 4945ee2 to 0852b62 Compare August 2, 2024 09:22
@marun marun force-pushed the e2e-test-context branch from 0852b62 to f5d5571 Compare August 2, 2024 18:12
@marun
Copy link
Contributor Author

marun commented Aug 2, 2024

Rebased

@StephenButtolph StephenButtolph added this pull request to the merge queue Aug 2, 2024
Merged via the queue into master with commit 91da538 Aug 2, 2024
20 checks passed
@StephenButtolph StephenButtolph deleted the e2e-test-context branch August 2, 2024 18:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
testing This primarily focuses on testing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants