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

Remove flaky test by avoiding reuse of name for replicaset #69739

Merged
merged 1 commit into from Oct 17, 2018

Conversation

mortent
Copy link
Member

@mortent mortent commented Oct 12, 2018

What this PR does / why we need it: As reported in #69376, run_rs_tests is flaky and the underlying cause is a problem with ReplicaSets when names are reused. The run_rs_tests actually tests kubectl, so this PR removes the flakiness by avoiding this issue with ReplicaSets. It should fix the flakiness and the issue in ReplicaSet can be fixed separately.

It complicates the test a bit with the use of sed, but it seemed better than using sleep or adding additional test data.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #69376

Special notes for your reviewer:
@kow3ns

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 12, 2018
@k8s-ci-robot k8s-ci-robot added sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 12, 2018
@mortent
Copy link
Member Author

mortent commented Oct 12, 2018

/test pull-kubernetes-integration

@@ -510,11 +510,12 @@ run_rs_tests() {
# Pre-condition: no replica set exists
kube::test::get_object_assert rs "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
kubectl create -f hack/testdata/frontend-replicaset.yaml "${kube_flags[@]}"
local replicaset_name="frontend-no-cascade"
sed -r 's/^(\s*)(name\s*:\s*frontend\s*$)/\1name: '"${replicaset_name}"'/' hack/testdata/frontend-replicaset.yaml | kubectl create "${kube_flags[@]}" -f -
Copy link
Member

Choose a reason for hiding this comment

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

Add a todo to revert this after the bug is fixed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added todo

@mortent
Copy link
Member Author

mortent commented Oct 12, 2018

/test pull-kubernetes-integration

1 similar comment
@mortent
Copy link
Member Author

mortent commented Oct 12, 2018

/test pull-kubernetes-integration

@mortent
Copy link
Member Author

mortent commented Oct 12, 2018

/assign @seans3

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 12, 2018
@kow3ns
Copy link
Member

kow3ns commented Oct 12, 2018

/remove lgtm

@neolit123
Copy link
Member

/kind failing-test

@k8s-ci-robot k8s-ci-robot added kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 13, 2018
@spiffxp
Copy link
Member

spiffxp commented Oct 17, 2018

/approve
I'm approving this in the hopes that it will de-flake #69376

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mortent, spiffxp

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 Oct 17, 2018
@k8s-ci-robot k8s-ci-robot merged commit bba6e25 into kubernetes:master Oct 17, 2018
runyontr added a commit to runyontr/kubernetes that referenced this pull request Jan 15, 2019
When the ReplicaSet controller fetches a fresh version of the ReplicaSet from the server
it validates that the UID of the fresh matches the one in the cache.  If the
UID does not match, a race condition outlined in the issue must have occurred and the
controller should intepret the call to syncReplicaSet as a delete.

Reverts the merge that temporarily fixed the bug that would occasionally fail as
a result of this bug.
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. 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. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReplicaSetController can miss handling the deletion of a ReplicaSet
7 participants