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

Use the old topology key for e2e tests #814

Merged
merged 1 commit into from
Mar 23, 2021

Conversation

ayberk
Copy link
Contributor

@ayberk ayberk commented Mar 23, 2021

Is this a bug fix or adding new feature?
/bug

What is this PR about? / Why do we need it?
e2e tests assumes only one topology key, so checks are hardcoded with the first element of each slice. Due to the recent addition of the well-known label as topology key, these checks might fail based on the ordering of the slice. This PR fixes it.

What testing is done?
Tested on my account and verified it works and does what I expect it to do.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 23, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 23, 2021
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1754

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 81.789%

Totals Coverage Status
Change from base Build 1747: 0.0%
Covered Lines: 1756
Relevant Lines: 2147

💛 - Coveralls

@wongma7
Copy link
Contributor

wongma7 commented Mar 23, 2021

Can we loop through and check both are present? That is the intention of our code, to provision PVs with both so that they are backwards compatible, we should test it.

@wongma7
Copy link
Contributor

wongma7 commented Mar 23, 2021

I don't mind merging to unblock CI but ideally we should test our driver-specific behavior in our driver-specific test suite otherwise what's the point of it! This kind of thing won't be covered by the external test suite.

@wongma7
Copy link
Contributor

wongma7 commented Mar 23, 2021

/lgtm
/approve

to unblock CI

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 23, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ayberk, wongma7

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

for _, v := range t.persistentVolume.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions {
if v.Key == "topology.ebs.csi.aws.com/zone" {
keyFound = true
Expect(v.Key).To(Equal(t.storageClass.AllowedTopologies[0].MatchLabelExpressions[0].Key))
Copy link
Contributor

Choose a reason for hiding this comment

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

This statement is pointless, it's a tautology, if you're in this if statement then this is already guaranteed to be true

Copy link
Contributor

Choose a reason for hiding this comment

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

never mind, I confused storageClass allowedTopoloigies with the PV spec field? I'm a bit lost TBH,whether my SC has the old key or new key, the PV should have both old or new key right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah PV has the both keys, but SC has one (in e2e tests it's always the oldest one, see above tests/e2e/driver/ebs_csi_driver.go). So we have to make sure we're comparing the correct keys.

For example, this test fails when t.persistentVolume.Spec.NodeAffinity.Required.NodeSelectorTerms[0].MatchExpressions[0].Key is not topology.ebs.csi.aws.com/zone, which is possible because we also have topology.kubernetes.io/zone in the slice.

@k8s-ci-robot k8s-ci-robot merged commit 19d0de2 into kubernetes-sigs:master Mar 23, 2021
@ayberk ayberk mentioned this pull request Mar 23, 2021
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants