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

🌱 add more e2e tests #121

Merged
merged 1 commit into from
May 31, 2023
Merged

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented May 30, 2023

What this PR does / why we need it:

This PR adds several e2e tests to verify deletion, upgrading and downgrading providers.

@k8s-ci-robot k8s-ci-robot requested review from damdo and JoelSpeed May 30, 2023 21:37
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 30, 2023
Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

Few suggestions inline, overall looks good to me

var _ = Describe("Create providers with minimal specified configuration", func() {
It("should succefully create a CoreProvider", func() {
var _ = Describe("Create, upgrade, downgrade and delete providers with minimal specified configuration", func() {
It("should successfully create a CoreProvider", func() {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to add a delete test for CoreProvider as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wrote a test for that (line 396). The thing is that in order to install other providers, we need Core Provider to be Ready. It means we can't delete it immediately and have to postpone this action.

Copy link
Member

Choose a reason for hiding this comment

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

Ah right, was thinking the same initially, thanks for clarification

Copy link
Member

Choose a reason for hiding this comment

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

@Fedosin feel free to resolve the conversation

Comment on lines +410 to +421
Expect(k8sclient.Delete(ctx, coreProvider)).To(Succeed())

By("Waiting for the core provider deployment to be deleted")
Eventually(func() bool {
deployment := &appsv1.Deployment{}
key := client.ObjectKey{Namespace: operatorNamespace, Name: coreProviderDeploymentName}
isReady, err := waitForObjectToBeDeleted(k8sclient, ctx, key, deployment)
if err != nil {
return false
}
return isReady
}, timeout).Should(Equal(true))
Copy link
Member

@furkatgofurov7 furkatgofurov7 May 30, 2023

Choose a reason for hiding this comment

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

perhaps it is better if we will move this code to the end of core provider tests at the beginning of the file (see this commment) and drop the dedicated "It" test case to shorten the 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.

Unfortunately we can't delete it earlier, because other providers will fail a preflight check that tests that Core Provider is Ready: https://github.com/kubernetes-sigs/cluster-api-operator/blob/main/internal/controller/preflight_checks.go#L130-L131

This PR adds several e2e tests to verify deletion, upgrading and
downgrading providers.
@Fedosin
Copy link
Contributor Author

Fedosin commented May 31, 2023

@furkatgofurov7 thanks for your review! I updated the tests as you suggested.

@furkatgofurov7
Copy link
Member

furkatgofurov7 commented May 31, 2023

@furkatgofurov7 thanks for your review! I updated the tests as you suggested.

@Fedosin thanks, looks good to me. The only thing might worth mentioning is, we could refactor the code around waiting for provider deployment/provider itself to be ready/deleted or checks for status.IntalledVersion and make it generic so that we could reuse it by just calling them instead. That being said, it can be a follow-up PR once this is merged 🙂

Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2023
@Fedosin
Copy link
Contributor Author

Fedosin commented May 31, 2023

@furkatgofurov7 ack, agree with you!

@furkatgofurov7
Copy link
Member

/cc @alexander-demicev

Copy link
Contributor

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexander-demicev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 31, 2023
@k8s-ci-robot k8s-ci-robot merged commit a21c7cc into kubernetes-sigs:main May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants