Skip to content

Commit 30a7664

Browse files
committed
Change way to create a pod in test
Signed-off-by: Ayato Tokubi <[email protected]>
1 parent 5147eeb commit 30a7664

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

test/e2e/common/node/pods.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ var _ = SIGDescribe("Pods", func() {
851851
ginkgo.By("Create set of pods")
852852
// create a set of pods in test namespace
853853
for _, podTestName := range podTestNames {
854-
_, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx,
854+
_ = podClient.Create(ctx,
855855
e2epod.MustMixinRestrictedPodSecurity(&v1.Pod{
856856
ObjectMeta: metav1.ObjectMeta{
857857
Name: podTestName,
@@ -866,8 +866,7 @@ var _ = SIGDescribe("Pods", func() {
866866
Name: "token-test",
867867
}},
868868
RestartPolicy: v1.RestartPolicyNever,
869-
}}), metav1.CreateOptions{})
870-
framework.ExpectNoError(err, "failed to create pod")
869+
}}))
871870
framework.Logf("created %v", podTestName)
872871
}
873872

@@ -929,8 +928,7 @@ var _ = SIGDescribe("Pods", func() {
929928
},
930929
})
931930
ginkgo.By("creating a Pod with a static label")
932-
_, err = f.ClientSet.CoreV1().Pods(testNamespaceName).Create(ctx, testPod, metav1.CreateOptions{})
933-
framework.ExpectNoError(err, "failed to create Pod %v in namespace %v", testPod.ObjectMeta.Name, testNamespaceName)
931+
_ = podClient.Create(ctx, testPod)
934932

935933
ginkgo.By("watching for Pod to be ready")
936934
ctxUntil, cancel := context.WithTimeout(ctx, f.Timeouts.PodStart)
@@ -1082,8 +1080,6 @@ var _ = SIGDescribe("Pods", func() {
10821080
the fields MUST equal the new values.
10831081
*/
10841082
framework.ConformanceIt("should patch a pod status", func(ctx context.Context) {
1085-
ns := f.Namespace.Name
1086-
podClient := f.ClientSet.CoreV1().Pods(ns)
10871083
podName := "pod-" + utilrand.String(5)
10881084
label := map[string]string{"e2e": podName}
10891085

@@ -1103,8 +1099,7 @@ var _ = SIGDescribe("Pods", func() {
11031099
},
11041100
},
11051101
})
1106-
pod, err := podClient.Create(ctx, testPod, metav1.CreateOptions{})
1107-
framework.ExpectNoError(err, "failed to create Pod %v in namespace %v", testPod.ObjectMeta.Name, ns)
1102+
pod := podClient.Create(ctx, testPod)
11081103
framework.ExpectNoError(e2epod.WaitForPodRunningInNamespace(ctx, f.ClientSet, pod), "Pod didn't start within time out period")
11091104

11101105
ginkgo.By("patching /status")

0 commit comments

Comments
 (0)