mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Fix pod creation for node e2e tests
This commit is contained in:
parent
076af3d1b5
commit
833720669c
@ -376,14 +376,12 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
By("creating the pod with failed condition")
|
By("creating the pod with failed condition")
|
||||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
|
|
||||||
Expect(err).ToNot(HaveOccurred(), "while creating pod")
|
|
||||||
|
|
||||||
err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
|
||||||
Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
|
|
||||||
|
|
||||||
var podClient *framework.PodClient
|
var podClient *framework.PodClient
|
||||||
podClient = f.PodClient()
|
podClient = f.PodClient()
|
||||||
|
pod = podClient.Create(pod)
|
||||||
|
|
||||||
|
err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
||||||
|
Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
|
||||||
|
|
||||||
By("updating the pod")
|
By("updating the pod")
|
||||||
podClient.Update(podName, func(pod *v1.Pod) {
|
podClient.Update(podName, func(pod *v1.Pod) {
|
||||||
@ -470,10 +468,12 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
By("creating the pod")
|
By("creating the pod")
|
||||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
|
var podClient *framework.PodClient
|
||||||
|
podClient = f.PodClient()
|
||||||
|
pod = podClient.Create(pod)
|
||||||
|
|
||||||
By("waiting for pod running")
|
By("waiting for pod running")
|
||||||
err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
||||||
Expect(err).NotTo(HaveOccurred(), "while waiting for pod to be running")
|
Expect(err).NotTo(HaveOccurred(), "while waiting for pod to be running")
|
||||||
|
|
||||||
By("creating a file in subpath")
|
By("creating a file in subpath")
|
||||||
@ -491,9 +491,6 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
By("updating the annotation value")
|
By("updating the annotation value")
|
||||||
var podClient *framework.PodClient
|
|
||||||
podClient = f.PodClient()
|
|
||||||
|
|
||||||
podClient.Update(podName, func(pod *v1.Pod) {
|
podClient.Update(podName, func(pod *v1.Pod) {
|
||||||
pod.ObjectMeta.Annotations["mysubpath"] = "mynewpath"
|
pod.ObjectMeta.Annotations["mysubpath"] = "mynewpath"
|
||||||
})
|
})
|
||||||
@ -609,17 +606,15 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
|||||||
|
|
||||||
// Start pod
|
// Start pod
|
||||||
By(fmt.Sprintf("Creating pod %s", pod.Name))
|
By(fmt.Sprintf("Creating pod %s", pod.Name))
|
||||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
|
var podClient *framework.PodClient
|
||||||
Expect(err).ToNot(HaveOccurred(), "while creating pod")
|
podClient = f.PodClient()
|
||||||
|
pod = podClient.Create(pod)
|
||||||
defer func() {
|
defer func() {
|
||||||
framework.DeletePodWithWait(f, f.ClientSet, pod)
|
framework.DeletePodWithWait(f, f.ClientSet, pod)
|
||||||
}()
|
}()
|
||||||
err = framework.WaitForPodRunningInNamespace(f.ClientSet, pod)
|
err := framework.WaitForPodRunningInNamespace(f.ClientSet, pod)
|
||||||
Expect(err).ToNot(HaveOccurred(), "while waiting for pod to be running")
|
Expect(err).ToNot(HaveOccurred(), "while waiting for pod to be running")
|
||||||
|
|
||||||
var podClient *framework.PodClient
|
|
||||||
podClient = f.PodClient()
|
|
||||||
|
|
||||||
By("updating the pod")
|
By("updating the pod")
|
||||||
podClient.Update(podName, func(pod *v1.Pod) {
|
podClient.Update(podName, func(pod *v1.Pod) {
|
||||||
pod.ObjectMeta.Annotations = map[string]string{"mysubpath": "newsubpath"}
|
pod.ObjectMeta.Annotations = map[string]string{"mysubpath": "newsubpath"}
|
||||||
@ -645,14 +640,15 @@ var _ = framework.KubeDescribe("Variable Expansion", func() {
|
|||||||
|
|
||||||
func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) {
|
func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) {
|
||||||
|
|
||||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(pod)
|
var podClient *framework.PodClient
|
||||||
Expect(err).ToNot(HaveOccurred(), "while creating pod")
|
podClient = f.PodClient()
|
||||||
|
pod = podClient.Create(pod)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
framework.DeletePodWithWait(f, f.ClientSet, pod)
|
framework.DeletePodWithWait(f, f.ClientSet, pod)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
||||||
Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
|
Expect(err).To(HaveOccurred(), "while waiting for pod to be running")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user