e2e: use Ginkgo context

All code must use the context from Ginkgo when doing API calls or polling for a
change, otherwise the code would not return immediately when the test gets
aborted.
This commit is contained in:
Patrick Ohly
2022-12-12 10:11:10 +01:00
parent bf1d1dfd0f
commit 2f6c4f5eab
418 changed files with 11489 additions and 11369 deletions

View File

@@ -114,11 +114,11 @@ var _ = SIGDescribe("Kubelet PodOverhead handling [LinuxOnly]", func() {
PodFixed: getResourceList("200m", "140Mi"),
},
}
_, err := f.ClientSet.NodeV1().RuntimeClasses().Create(context.TODO(), rc, metav1.CreateOptions{})
_, err := f.ClientSet.NodeV1().RuntimeClasses().Create(ctx, rc, metav1.CreateOptions{})
framework.ExpectNoError(err, "failed to create RuntimeClass resource")
})
ginkgo.By("Creating a Guaranteed pod with which has Overhead defined", func() {
guaranteedPod = e2epod.NewPodClient(f).CreateSync(&v1.Pod{
guaranteedPod = e2epod.NewPodClient(f).CreateSync(ctx, &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "pod-with-overhead-",
Namespace: f.Namespace.Name,
@@ -140,8 +140,8 @@ var _ = SIGDescribe("Kubelet PodOverhead handling [LinuxOnly]", func() {
ginkgo.By("Checking if the pod cgroup was created appropriately", func() {
cgroupsToVerify := []string{"pod" + podUID}
pod := makePodToVerifyCgroupSize(cgroupsToVerify, "30000", "251658240")
pod = e2epod.NewPodClient(f).Create(pod)
err := e2epod.WaitForPodSuccessInNamespace(f.ClientSet, pod.Name, f.Namespace.Name)
pod = e2epod.NewPodClient(f).Create(ctx, pod)
err := e2epod.WaitForPodSuccessInNamespace(ctx, f.ClientSet, pod.Name, f.Namespace.Name)
framework.ExpectNoError(err)
})
})