mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 06:32:32 +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:
@@ -220,7 +220,7 @@ var _ = SIGDescribe("InitContainer [NodeConformance]", func() {
|
||||
},
|
||||
}
|
||||
var events []watch.Event
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(ctx, framework.PodStartTimeout)
|
||||
defer cancel()
|
||||
event, err := watchtools.Until(ctx, startedPod.ResourceVersion, w,
|
||||
recordEvents(events, conditions.PodCompleted),
|
||||
@@ -301,7 +301,7 @@ var _ = SIGDescribe("InitContainer [NodeConformance]", func() {
|
||||
},
|
||||
}
|
||||
var events []watch.Event
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(ctx, framework.PodStartTimeout)
|
||||
defer cancel()
|
||||
event, err := watchtools.Until(ctx, startedPod.ResourceVersion, w, recordEvents(events, conditions.PodRunning))
|
||||
framework.ExpectNoError(err)
|
||||
@@ -382,7 +382,7 @@ var _ = SIGDescribe("InitContainer [NodeConformance]", func() {
|
||||
}
|
||||
|
||||
var events []watch.Event
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(ctx, framework.PodStartTimeout)
|
||||
defer cancel()
|
||||
event, err := watchtools.Until(
|
||||
ctx,
|
||||
@@ -507,7 +507,7 @@ var _ = SIGDescribe("InitContainer [NodeConformance]", func() {
|
||||
}
|
||||
|
||||
var events []watch.Event
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), framework.PodStartTimeout)
|
||||
ctx, cancel := watchtools.ContextWithOptionalTimeout(ctx, framework.PodStartTimeout)
|
||||
defer cancel()
|
||||
event, err := watchtools.Until(
|
||||
ctx, startedPod.ResourceVersion, w,
|
||||
|
@@ -266,7 +266,7 @@ var _ = SIGDescribe("Pods", func() {
|
||||
_, informer, w, _ := watchtools.NewIndexerInformerWatcher(lw, &v1.Pod{})
|
||||
defer w.Stop()
|
||||
|
||||
ctx, cancelCtx := context.WithTimeout(context.TODO(), wait.ForeverTestTimeout)
|
||||
ctx, cancelCtx := context.WithTimeout(ctx, wait.ForeverTestTimeout)
|
||||
defer cancelCtx()
|
||||
if !cache.WaitForCacheSync(ctx.Done(), informer.HasSynced) {
|
||||
framework.Failf("Timeout while waiting to Pod informer to sync")
|
||||
@@ -932,7 +932,7 @@ var _ = SIGDescribe("Pods", func() {
|
||||
framework.ExpectNoError(err, "failed to create Pod %v in namespace %v", testPod.ObjectMeta.Name, testNamespaceName)
|
||||
|
||||
ginkgo.By("watching for Pod to be ready")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), f.Timeouts.PodStart)
|
||||
ctx, cancel := context.WithTimeout(ctx, f.Timeouts.PodStart)
|
||||
defer cancel()
|
||||
_, err = watchtools.Until(ctx, podsList.ResourceVersion, w, func(event watch.Event) (bool, error) {
|
||||
if pod, ok := event.Object.(*v1.Pod); ok {
|
||||
|
Reference in New Issue
Block a user