mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
e2e: fix linter errors
Adding "ctx" as parameter in the previous commit led to some linter errors about code that overwrites "ctx" without using it. This gets fixed by replacing context.Background or context.TODO in those code lines with the new ctx parameter. Two context.WithCancel calls can get removed completely because the context automatically gets cancelled by Ginkgo when the test returns.
This commit is contained in:
@@ -919,7 +919,7 @@ var _ = SIGDescribe("Daemon set [Serial]", func() {
|
||||
framework.Logf("updatedStatus.Conditions: %#v", updatedStatus.Status.Conditions)
|
||||
|
||||
ginkgo.By("watching for the daemon set status to be updated")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), dsRetryTimeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, dsRetryTimeout)
|
||||
defer cancel()
|
||||
_, err = watchtools.Until(ctx, dsList.ResourceVersion, w, func(event watch.Event) (bool, error) {
|
||||
if ds, ok := event.Object.(*appsv1.DaemonSet); ok {
|
||||
|
@@ -215,7 +215,7 @@ var _ = SIGDescribe("Deployment", func() {
|
||||
framework.ExpectNoError(err, "failed to create Deployment %v in namespace %v", testDeploymentName, testNamespaceName)
|
||||
|
||||
ginkgo.By("waiting for Deployment to be created")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
_, err = watchtools.Until(ctx, deploymentsList.ResourceVersion, w, func(event watch.Event) (bool, error) {
|
||||
switch event.Type {
|
||||
@@ -542,7 +542,7 @@ var _ = SIGDescribe("Deployment", func() {
|
||||
framework.Logf("updatedStatus.Conditions: %#v", updatedStatus.Status.Conditions)
|
||||
|
||||
ginkgo.By("watching for the Deployment status to be updated")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), dRetryTimeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, dRetryTimeout)
|
||||
defer cancel()
|
||||
|
||||
_, err = watchtools.Until(ctx, dList.ResourceVersion, w, func(event watch.Event) (bool, error) {
|
||||
|
@@ -796,7 +796,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
return f.ClientSet.CoreV1().Pods(f.Namespace.Name).Watch(context.TODO(), options)
|
||||
},
|
||||
}
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), statefulPodTimeout)
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(ctx, statefulPodTimeout)
|
||||
defer cancel()
|
||||
// we need to get UID from pod in any state and wait until stateful set controller will remove pod at least once
|
||||
_, err = watchtools.Until(ctx, pl.ResourceVersion, lw, func(event watch.Event) (bool, error) {
|
||||
@@ -1034,7 +1034,7 @@ var _ = SIGDescribe("StatefulSet", func() {
|
||||
|
||||
ginkgo.By("watching for the statefulset status to be updated")
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), statefulSetTimeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, statefulSetTimeout)
|
||||
defer cancel()
|
||||
|
||||
_, err = watchtools.Until(ctx, ssList.ResourceVersion, w, func(event watch.Event) (bool, error) {
|
||||
|
Reference in New Issue
Block a user