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

@@ -86,7 +86,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
runtimePids, err := getPidsForProcess(framework.TestContext.ContainerRuntimeProcessName, framework.TestContext.ContainerRuntimePidFile)
framework.ExpectNoError(err, "failed to get list of container runtime pids")
for _, pid := range runtimePids {
gomega.Eventually(func() error {
gomega.Eventually(ctx, func() error {
return validateOOMScoreAdjSetting(pid, -999)
}, 5*time.Minute, 30*time.Second).Should(gomega.BeNil())
}
@@ -95,7 +95,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
kubeletPids, err := getPidsForProcess(kubeletProcessName, "")
framework.ExpectNoError(err, "failed to get list of kubelet pids")
framework.ExpectEqual(len(kubeletPids), 1, "expected only one kubelet process; found %d", len(kubeletPids))
gomega.Eventually(func() error {
gomega.Eventually(ctx, func() error {
return validateOOMScoreAdjSetting(kubeletPids[0], -999)
}, 5*time.Minute, 30*time.Second).Should(gomega.BeNil())
})
@@ -110,7 +110,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
podClient := e2epod.NewPodClient(f)
podName := "besteffort" + string(uuid.NewUUID())
podClient.Create(&v1.Pod{
podClient.Create(ctx, &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: podName,
},
@@ -126,7 +126,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
var pausePids []int
ginkgo.By("checking infra container's oom-score-adj")
gomega.Eventually(func() error {
gomega.Eventually(ctx, func() error {
pausePids, err = getPidsForProcess("pause", "")
if err != nil {
return fmt.Errorf("failed to get list of pause pids: %v", err)
@@ -144,7 +144,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
}, 2*time.Minute, time.Second*4).Should(gomega.BeNil())
var shPids []int
ginkgo.By("checking besteffort container's oom-score-adj")
gomega.Eventually(func() error {
gomega.Eventually(ctx, func() error {
shPids, err = getPidsForProcess("agnhost", "")
if err != nil {
return fmt.Errorf("failed to get list of serve hostname process pids: %v", err)
@@ -177,7 +177,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
ginkgo.It("guaranteed container's oom-score-adj should be -998", func(ctx context.Context) {
podClient := e2epod.NewPodClient(f)
podName := "guaranteed" + string(uuid.NewUUID())
podClient.Create(&v1.Pod{
podClient.Create(ctx, &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: podName,
},
@@ -200,7 +200,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
ngPids []int
err error
)
gomega.Eventually(func() error {
gomega.Eventually(ctx, func() error {
ngPids, err = getPidsForProcess("nginx", "")
if err != nil {
return fmt.Errorf("failed to get list of nginx process pids: %v", err)
@@ -218,7 +218,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
ginkgo.It("burstable container's oom-score-adj should be between [2, 1000)", func(ctx context.Context) {
podClient := e2epod.NewPodClient(f)
podName := "burstable" + string(uuid.NewUUID())
podClient.Create(&v1.Pod{
podClient.Create(ctx, &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: podName,
},
@@ -242,7 +242,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
wsPids []int
err error
)
gomega.Eventually(func() error {
gomega.Eventually(ctx, func() error {
wsPids, err = getPidsForProcess("agnhost", "")
if err != nil {
return fmt.Errorf("failed to get list of test-webserver process pids: %v", err)