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

@@ -90,7 +90,7 @@ func makePodToVerifyPids(baseName string, pidsLimit resource.Quantity) *v1.Pod {
func runPodPidsLimitTests(f *framework.Framework) {
ginkgo.It("should set pids.max for Pod", func(ctx context.Context) {
ginkgo.By("by creating a G pod")
pod := e2epod.NewPodClient(f).Create(&v1.Pod{
pod := e2epod.NewPodClient(f).Create(ctx, &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "pod" + string(uuid.NewUUID()),
Namespace: f.Namespace.Name,
@@ -113,8 +113,8 @@ func runPodPidsLimitTests(f *framework.Framework) {
podUID := string(pod.UID)
ginkgo.By("checking if the expected pids settings were applied")
verifyPod := makePodToVerifyPids("pod"+podUID, resource.MustParse("1024"))
e2epod.NewPodClient(f).Create(verifyPod)
err := e2epod.WaitForPodSuccessInNamespace(f.ClientSet, verifyPod.Name, f.Namespace.Name)
e2epod.NewPodClient(f).Create(ctx, verifyPod)
err := e2epod.WaitForPodSuccessInNamespace(ctx, f.ClientSet, verifyPod.Name, f.Namespace.Name)
framework.ExpectNoError(err)
})
}
@@ -124,7 +124,7 @@ var _ = SIGDescribe("PodPidsLimit [Serial]", func() {
f := framework.NewDefaultFramework("pids-limit-test")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
ginkgo.Context("With config updated with pids limits", func() {
tempSetCurrentKubeletConfig(f, func(initialConfig *kubeletconfig.KubeletConfiguration) {
tempSetCurrentKubeletConfig(f, func(ctx context.Context, initialConfig *kubeletconfig.KubeletConfiguration) {
initialConfig.PodPidsLimit = int64(1024)
})
runPodPidsLimitTests(f)