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

Consolidate e2e logic #3392

Merged
merged 45 commits into from
Mar 12, 2024
Merged

Consolidate e2e logic #3392

merged 45 commits into from
Mar 12, 2024

Conversation

mociarain
Copy link
Collaborator

@mociarain mociarain commented Feb 8, 2024

Which issue this PR addresses:

This PR is just a little refactor really but doubles as an example of how we can compose the generics into more distinct blocks. This might seem like overkill (an argument I'm open to despite what I'm about to say) but IMO this is a perfect example of what we can do with generics. The alternative to this function would be 5-6 near identical functions i.e. CleanUp{Pods/Services/Namespace...}.

Let me know what you think

Test plan for issue:

The E2E tests

Is there any documentation that needs to be updated for this PR?

No

Copy link
Contributor

@jaitaiwan jaitaiwan left a comment

Choose a reason for hiding this comment

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

One thing that concerns me about this PR but nothing to do with how you've structured it. The structure seems fine to me.

Small potential nit: In some cases you seem to opt for go's named returns - I'm not sure if this is a pattern that we commonly do in the RP code - it would be good to use whatever is the common parlance.

I personally have found it to be confusing when reviewing code but others may differ :)

test/e2e/adminapi_cluster_getlogs.go Show resolved Hide resolved
@mociarain
Copy link
Collaborator Author

One thing that concerns me about this PR but nothing to do with how you've structured it. The structure seems fine to me.

Small potential nit: In some cases you seem to opt for go's named returns - I'm not sure if this is a pattern that we commonly do in the RP code - it would be good to use whatever is the common parlance.

I personally have found it to be confusing when reviewing code but others may differ :)

TBH I don't know why I used it and reflecting I don't like it either. Thanks for the steer and I'll revert it

@hawkowl
Copy link
Collaborator

hawkowl commented Feb 21, 2024

I think the Go 1.20 change will let you get rid of the explicit typing in the usage of this...

@mociarain
Copy link
Collaborator Author

I think the Go 1.20 change will let you get rid of the explicit typing in the usage of this...

Nice. I'll make a note to loop back on this. Thanks for the heads up

test/e2e/helpers.go Show resolved Hide resolved
test/e2e/helpers.go Show resolved Hide resolved
@@ -93,11 +90,40 @@ func CreateK8sObjectWithRetry[T kruntime.Object](
// and the parameters for it. It then makes the call with some retry logic.
func DeleteK8sObjectWithRetry(
ctx context.Context, deleteFunc K8sDeleteFunc, name string, options metav1.DeleteOptions,
) {
) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am probably missing something, but In which cases is this function used in the cleanup? Isn't the cleanup using directly the Delete method from the clients.

@mociarain
Copy link
Collaborator Author

I am probably missing something, but In which cases is this function used in the cleanup? Isn't the cleanup using directly the Delete method from the clients.

Sometimes we just need to delete something: https://github.com/azure/ARO-RP/blob/77fa007891c18eeee0f217b74ff47e0e7c730a54/test/e2e/operator.go#L191

I suppose we could switch all called to DeleteK8sObjectWithRetry to CleanUp but that seems unnecessary/bad. What do you think?

@mociarain
Copy link
Collaborator Author

/azp run e2e

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Azure Azure deleted a comment from azure-pipelines bot Mar 5, 2024
Copy link
Contributor

@tiguelu tiguelu left a comment

Choose a reason for hiding this comment

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

lgtm

@mociarain
Copy link
Collaborator Author

/azp run ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@jaitaiwan jaitaiwan left a comment

Choose a reason for hiding this comment

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

LGTM. Great job mate

@tiguelu
Copy link
Contributor

tiguelu commented Mar 11, 2024

/azp run e2e

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tiguelu tiguelu merged commit 0eea1ec into master Mar 12, 2024
20 checks passed
@tiguelu tiguelu deleted the consolidate-e2e-logic branch March 12, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code ready-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants