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

Update function signature of testutil.NewGenericTestHelper #4591

Merged
merged 4 commits into from
Jun 18, 2020

Conversation

mayankshah1607
Copy link
Contributor

@mayankshah1607 mayankshah1607 commented Jun 12, 2020

This PR is a follow-up for #4532

Once merged, testutil.NewGenericTestHelper will

  • accept version, httpClient and k8sContext as parameters
  • initialize the KubernetesHelper field in the returned instance of *TestHelper

Signed-off-by: Mayank Shah mayankshah1614@gmail.com

Cc: @Pothulapati @alpeb

Copy link
Member

@alpeb alpeb left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -76,9 +77,11 @@ func NewGenericTestHelper(
helmReleaseName string,
externalIssuer,
uninstall bool,
httpClient http.Client,
) *TestHelper {
return &TestHelper{
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there is also KubernetesHelper variable in TestHelper. Maybe we can use that somewhere in the code using the returned value from NewKubernetesHelper()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, nice catch - was only considering setting the private fields through this method, but it certainly makes sense to initialize the KubernetesHelper field as well. That would mean that NewGenericTestHelper would now also have to accept k8sContext as a parameter and also return the error returned from NewKubernetesHelper.

I have pushed the changes incorporating the above. PTAL! 😄

@olix0r
Copy link
Member

olix0r commented Jun 15, 2020

@mayankshah1607 Would you mind updating the PR title to describe what this change does? Consider how this description will fit in the output of git log later -- try to make it easy for people to understand what is changing in the summary, and then the description should explain why and how. Thanks!

@mayankshah1607 mayankshah1607 changed the title Follow up PR for #4532 Update function signature of testutil.NewGenericTestHelper Jun 15, 2020
}

kubernetesHelper, err := NewKubernetesHelper(k8sContext, h.RetryFor)
Copy link
Contributor

Choose a reason for hiding this comment

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

As the kubernetesHelper is public, and so is NewKubernetesHelper(), why can't we just take it as a argument and assign it directly, rather than using this function directly. Any upsides to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@mayankshah1607 mayankshah1607 requested a review from a team as a code owner June 16, 2020 07:42
@mayankshah1607 mayankshah1607 force-pushed the mayank/testutil-followup branch from c39849c to e02bec8 Compare June 16, 2020 07:47
Copy link
Member

@zaharidichev zaharidichev left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Pothulapati Pothulapati left a comment

Choose a reason for hiding this comment

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

LGTM! :)

- Updates function signature of `NewGenericTestHelper` to accept `version` and an `httpClient`

Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
- accept `k8sContext` as a parameter for the above method
- set the `KubernetesHelper` field in the returned `TestHelper`
- return errors encountered in the function body

Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
- remove `k8sContext` as parameter
- add `kubernetesHelper` as parameter
- initialize KubernetesHelper field directly using the `kubernetesHelper` parameter

Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
@mayankshah1607 mayankshah1607 force-pushed the mayank/testutil-followup branch from e02bec8 to eb29dac Compare June 18, 2020 06:41
Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
@mayankshah1607 mayankshah1607 force-pushed the mayank/testutil-followup branch from 176dbbc to 8242231 Compare June 18, 2020 07:14
@Pothulapati Pothulapati merged commit 9004137 into linkerd:master Jun 18, 2020
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.

5 participants