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

fixed e2e vsphere statefulsets test #92787

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions test/e2e/storage/vsphere/vsphere_statefulsets.go
Expand Up @@ -66,10 +66,6 @@ var _ = utils.SIGDescribe("vsphere statefulset [Feature:vsphere]", func() {
client = f.ClientSet
Bootstrap(f)
})
ginkgo.AfterEach(func() {
framework.Logf("Deleting all statefulset in namespace: %v", namespace)
e2estatefulset.DeleteAllStatefulSets(client, namespace)
})

ginkgo.It("vsphere statefulset testing", func() {
ginkgo.By("Creating StorageClass for Statefulset")
Expand All @@ -83,6 +79,7 @@ var _ = utils.SIGDescribe("vsphere statefulset [Feature:vsphere]", func() {
ginkgo.By("Creating statefulset")

statefulset := e2estatefulset.CreateStatefulSet(client, manifestPath, namespace)
defer e2estatefulset.DeleteAllStatefulSets(client, namespace)
Copy link
Member

@neolit123 neolit123 Jul 6, 2020

Choose a reason for hiding this comment

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

#92785

Issue-2 - After upgrading apiVersion from apps/v1. Test executed successfully but reported failure in the after each cleanup stage.
Jul 3 20:34:46.049: FAIL: Failed waiting for stateful set status.replicas updated to 0: statefulsets.apps "web" not found
...
This is happening because of the incorrect usage of WaitForStatusReplicas after calling c.AppsV1().StatefulSets(ss.Namespace).Delete.

trying to understand more here and why this change matters.

are you suggesting that DeleteAllStatefulSets() gets called before WaitForStatusReplicas() if the DeleteAllStatefulSets() call is inside AfterEach(...)? are these tests run in parallel when you saw the problem?

https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/vsphere/vsphere_statefulsets.go#L131

/cc @SandeepPissay
vSphere storage

/cc @gnufied @pohly
SIG Storage / e2e

Copy link
Member Author

Choose a reason for hiding this comment

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

@neolit123

why this change matters

We want to avoid printing below error message in the test for AfterEach call.

This could be because of the race between namespace deletion and AfterEach execution. I am not familiar with the framework. When c.AppsV1().StatefulSets(ss.Namespace).Delete is called, it is not finding a stateful set.

[AfterEach] [sig-storage] vsphere statefulset [Feature:vsphere]
  /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/storage/vsphere/vsphere_statefulsets.go:69
Jul  3 20:34:25.949: INFO: Deleting all statefulset in namespace: vsphere-statefulset-4079
Jul  3 20:34:25.964: INFO: Scaling statefulset web to 0
Jul  3 20:34:46.036: INFO: Waiting for statefulset status.replicas updated to 0
Jul  3 20:34:46.049: FAIL: Failed waiting for stateful set status.replicas updated to 0: statefulsets.apps "web" not found

Full Stack Trace
k8s.io/kubernetes/test/e2e/framework/statefulset.WaitForStatusReplicas(0x5e49f80, 0xc00083c6e0, 0xc000cf6f00, 0x0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/statefulset/wait.go:145 +0x22e
k8s.io/kubernetes/test/e2e/framework/statefulset.DeleteAllStatefulSets(0x5e49f80, 0xc00083c6e0, 0xc0035a80a0, 0x18)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/framework/statefulset/rest.go:86 +0x3a9
k8s.io/kubernetes/test/e2e/storage/vsphere.glob..func5.2()
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/storage/vsphere/vsphere_statefulsets.go:71 +0xe0
k8s.io/kubernetes/test/e2e.RunE2ETests(0xc000124ea0)
	_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/e2e.go:130 +0x337
k8s.io/kubernetes/test/e2e.TestE2E(0xc000124ea0)
	_output/dockerized/go/src/k8s.io/kubernetes/test/e2e/e2e_test.go:145 +0x2b
testing.tRunner(0xc000124ea0, 0x55e7630)
	/usr/local/go/src/testing/testing.go:991 +0xdc
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1042 +0x357

• Failure in Spec Teardown (AfterEach) [146.105 seconds]

replicas := *(statefulset.Spec.Replicas)
// Waiting for pods status to be Ready
e2estatefulset.WaitForStatusReadyReplicas(client, statefulset, replicas)
Expand Down
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
Copy link
Member

Choose a reason for hiding this comment

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

LGTM as StatefulSet in the apps/v1beta1 and apps/v1beta2 API versions is no longer served according to https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/

kind: StatefulSet
metadata:
name: web
Expand Down