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

ensure feature gate changes don't escape unit tests #71100

Merged
merged 5 commits into from
Nov 16, 2018

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Nov 16, 2018

What type of PR is this?
/kind bug

What this PR does / why we need it:
while reviewing tests in #65829, we realized some unit tests originally set up to test behavior when an alpha gate was enabled, were leaking changes to feature gates out of their packages by attempting to reset them to the old, default, disabled values.

This adds a package-level check that feature gates are not modified once tests are complete in a package and fixes existing tests that leaked feature gate changes beyond their package. This is critical that our unit tests are working with default feature gate values.

Will follow up with validation scripts that ensure this check is done in any package setting feature gates in test files.

fixes #71091

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/bug Categorizes issue or PR as related to a bug. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 16, 2018
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/apiserver area/kubelet sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 16, 2018
@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

/assign @msau42

@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

/milestone v1.13

@k8s-ci-robot k8s-ci-robot added this to the v1.13 milestone Nov 16, 2018
@liggitt liggitt force-pushed the feature-gate-testing branch 8 times, most recently from 9c95e76 to afa079e Compare November 16, 2018 03:32
@AishSundar
Copy link
Contributor

@msau42 how confident are we in getting this in by Code freeze tomorrow?

@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

/assign @smarterclayton
test-only changes, but needs top-level approval

rc := tests()

finalSet := fmt.Sprint(gate)
if finalSet != originalSet {
Copy link
Contributor

Choose a reason for hiding this comment

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

Follow up for someone - we should be able to read the feature gates instead of having ot parse from string.

@smarterclayton
Copy link
Contributor

For the follow up verbally confirmed that gate would also check main_test.go exists

@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

opened #71108 to track follow-up tasks for this... I'm on the fence about a way to export a map from a feature gate

@smarterclayton
Copy link
Contributor

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, smarterclayton

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 Nov 16, 2018
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 16, 2018
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

rebased, fixed up unit tests added in https://github.com/kubernetes/kubernetes/pull/68635/files#diff-bda636cade29666ccecd6df250c834b8R87 last night, retagging

@liggitt liggitt added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 16, 2018
@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

/retest

@msau42
Copy link
Member

msau42 commented Nov 16, 2018

/lgtm

@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

/retest

1 similar comment
@liggitt
Copy link
Member Author

liggitt commented Nov 16, 2018

/retest

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/apiserver area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VolumeScheduling unit tests assume the feature gate is off
5 participants