-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
conformance validation: add new helper to testutil
#4532
conformance validation: add new helper to testutil
#4532
Conversation
- Add new struct `ConformanceTestHelperOptions` `ConformanceTestHelperOptions` defines the TestHelper options required for conformance validation - https://github.com/linkerd/linkerd2-conformance This way the default options may be defined in the linkerd2-conformance repo, and an instance can be passed to NewConformanceTestHelper() to obtain a *TestHelper - Add new helper function `NewConformanceTestHelper` `NewConformanceTestHelper` accepts a *ConformanceTestHelperOptions and returns a new *TestHelper from the options provided. This helper was created to be able to reuse the `testutil` package for Conformance validation See - linkerd#4530 Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
testutil
testutil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mayankshah1607 This is even useful for things like #4448 where we would want to initialize a testHelper without hard restrictions, How about having the function name and the options be more generic? It can be used not only with conformance right? :)
Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
@Pothulapati That makes sense! I've updated the names, mind taking a look again? I hope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Pinging @alpeb for another approval! :) |
@mayankshah1607 can you try embedding structs so that there's not so much duplication between |
- Instead of depending on a redundant `GenericTestHelperOptions`, the `NewGenericTestHelper` returns and instance of `TestHelper` from the function arguments provided - Remove redundant `GenericTestHelperOptions` Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
@alpeb Making the fields of the This way, the This would not only satisfy our current requirements for #4448 and #4530 , but would also ensure that we do not have to deal with refactoring the rest of the integration tests code. I've just pushed this change (this commit). Could you please have a look and let me know if this sounds okay? Thanks again 😄 Cc: @Pothulapati |
Ideally, we would want the fields to be public but we don't see the need for it yet. (especially considering it would take a huge refactor i.e updating fields everywhere). IMO, we should go with this PR for now, and come back to make the fields public if its needed in the future. WDYT? |
@Pothulapati sounds cool! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @Pothulapati , a struct is preferable to a large function signature, but let's not block this PR and we can address that later.
- Updates function signature of `NewGenericTestHelper` to accept `version` and an `httpClient` Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
- Updates function signature of `NewGenericTestHelper` to accept `version` and an `httpClient` Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
Fixes #4530
GenericTestHelperOptions
GenericTestHelperOptions
defines theTestHelper
optionsthat are used along with
NewGenericTestHelper()
method to obtain a*TestHelper
NewGenericTestHelper
NewGenericTestHelper
accepts a*GenericTestHelperOptions
and returns a new*TestHelper
from the options provided. This helper was created to be able to reuse thetestutil
package without any hard restrictionsSigned-off-by: Mayank Shah mayankshah1614@gmail.com