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

Make external driver name generation contain a more random suffix in case of double generation in the same framework context (twice in the same test) #77525

Merged
merged 1 commit into from May 8, 2019

Conversation

davidz627
Copy link
Contributor

Fixes multivolume tests for external drivers.

/kind bug
/kind failing-test
/sig storage

/assign @msau42 @pohly
/cc @mkimuram

NONE

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label May 7, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 7, 2019
@k8s-ci-robot k8s-ci-robot requested a review from mkimuram May 7, 2019 00:28
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/storage Categorizes an issue or PR as relevant to SIG Storage. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 7, 2019
@davidz627
Copy link
Contributor Author

davidz627 commented May 7, 2019

Ran the multivolume tests with this fix with the external GCE PD CSI Driver and confirmed this fixes the issue

@msau42
Copy link
Member

msau42 commented May 7, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 7, 2019
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@msau42
Copy link
Member

msau42 commented May 7, 2019

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 7, 2019
@pohly
Copy link
Contributor

pohly commented May 7, 2019

PatchItems was named this way because I wanted to have the ability to add other changes later without having to rename the function each time it gains a new feature. Renaming the function now is an API change that potentially can break users of the framework. I'd prefer to not rename it.

Regarding the actual change: the name space is already random. Can you explain in a bit more detail (ideally in the commit message) what problem you are trying to solve? It's not clear to me from the given information, and it looks like the fix isn't right either because other tests are now failing (or was that due to something unrelated?).

@davidz627
Copy link
Contributor Author

PatchItems was named this way because I wanted to have the ability to add other changes later without having to rename the function each time it gains a new feature. Renaming the function now is an API change that potentially can break users of the framework. I'd prefer to not rename it.

Thats fair; however, patch items means absolutely nothing and was one of the reasons why it took me longer than it should have to debug this issue. Unless you are already an expert in this code its almost impossible to know what it's doing and how to find the place where the name is being generated.

Also lets not design things for a potential future use case that we haven't thought of or needed. This name describes what the function currently does and it is not costly to be renamed if it needs to be refactored/rewritten later.

Regarding the actual change: the name space is already random. Can you explain in a bit more detail (ideally in the commit message) what problem you are trying to solve? It's not clear to me from the given information, and it looks like the fix isn't right either because other tests are now failing (or was that due to something unrelated?).

The multiVolume tests run createGenericTestResource twice, thus creating two storage classes in the same test framework. The namespace name is stable in the context of a test so the two storage classes are created with the same name and the tests fail. As for unrelated failing tests, I'm looking into them now but on first glance it looks like the CSI tests were inferring generated names for cluster role yamls and not using the actual generated names.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 7, 2019
@davidz627
Copy link
Contributor Author

/retest

@pohly
Copy link
Contributor

pohly commented May 7, 2019 via email

@davidz627
Copy link
Contributor Author

/priority important-soon
resolved test failures

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 7, 2019
@davidz627
Copy link
Contributor Author

Changing the public API of the E2E framework is costly. Everyone using it has to make the same change. If you feel strongly about this, then please submit a separate cleanup PR.

I would argue that changing the function name when functionality changes forces you to think about whether this functionality change works for all function callers. If we are exporting this function as a public API, shouldn't the returned result (the modified object since this modifies objects in-place) be stable as well? If you are thinking about other callers using this function doesn't keeping an ambiguous function name PatchItem and "have the ability to add other changes later without having to rename the function each time it gains a new feature," explicitly break all API rules by being ambiguous and changing behavior under consumers feet.

It sounds a bit like it might better to handle this special case in the multiVolume test by explicitly renaming the storage classes, and just the storage classes. Anyway, I'll let you investigate this further.

Done

@msau42
Copy link
Member

msau42 commented May 7, 2019

Are we officially supporting the Kubernetes e2e test framework as a publicly consumable library outside of kubernetes/kubernetes?

@pohly
Copy link
Contributor

pohly commented May 7, 2019 via email

…dom suffix in case of double generation in the same framework context (twice in the same test)
@davidz627
Copy link
Contributor Author

@pohly removed the function name change

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidz627, msau42

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

@msau42
Copy link
Member

msau42 commented May 7, 2019

/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 7, 2019
@msau42
Copy link
Member

msau42 commented May 7, 2019

/test pull-kubernetes-e2e-gce-storage-slow
/test pull-kubernetes-e2e-gce-csi-serial

@davidz627
Copy link
Contributor Author

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 8, 2019

@davidz627: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-gce-storage-slow c50e7fd link /test pull-kubernetes-e2e-gce-storage-slow

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

func (f *Framework) PatchName(item *string) {
// uniquifyName makes the name of some item unique per namespace by appending the
// generated unique name of the test namespace.
func (f *Framework) uniquifyName(item *string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still an API change. When this create.go was initially merged, I was explicitly asked to split it up so that someone can load items, patch them (either with the existing PatchItems or some custom code), and then create them.

Such custom code is meant to have access to individual building blocks like this PatchName.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

feel free to submit a PR changing these back to external

case *storage.StorageClass:
f.PatchName(&item.Name)
f.randomizeStorageClassName(&item.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now storage classes are "more unique" than other items and regardless what we call the function which does this, I'm worried that this will be confusing.

Where is this failing test code that must load storage classes twice into the same namespace?

// all items can be namespaced. For those, the name also needs to be
// patched.
func (f *Framework) PatchNamespace(item *string) {
func (f *Framework) patchNamespace(item *string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same API change here.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 086a86b into kubernetes:master May 8, 2019
@pohly
Copy link
Contributor

pohly commented May 8, 2019

Hrmm, I hadn't realized that this had both lgtm and approval. I don't think this should have been merged.

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. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants