mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Address comments: remove unused resourceVersion in e2e util wait loop; poll pods every 2 seconds
This commit is contained in:
parent
5a7929dc2d
commit
7c89359cc8
@ -361,7 +361,7 @@ func runLivenessTest(f *framework.Framework, pod *v1.Pod, expectNumRestarts int,
|
|||||||
// Wait until the pod is not pending. (Here we need to check for something other than
|
// Wait until the pod is not pending. (Here we need to check for something other than
|
||||||
// 'Pending' other than checking for 'Running', since when failures occur, we go to
|
// 'Pending' other than checking for 'Running', since when failures occur, we go to
|
||||||
// 'Terminated' which can cause indefinite blocking.)
|
// 'Terminated' which can cause indefinite blocking.)
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(f.ClientSet, ns, pod.Name, pod.ResourceVersion),
|
framework.ExpectNoError(framework.WaitForPodNotPending(f.ClientSet, ns, pod.Name),
|
||||||
fmt.Sprintf("starting pod %s in namespace %s", pod.Name, ns))
|
fmt.Sprintf("starting pod %s in namespace %s", pod.Name, ns))
|
||||||
framework.Logf("Started pod %s in namespace %s", pod.Name, ns)
|
framework.Logf("Started pod %s in namespace %s", pod.Name, ns)
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ var _ = framework.KubeDescribe("ClusterDns [Feature:Example]", func() {
|
|||||||
// wait until the pods have been scheduler, i.e. are not Pending anymore. Remember
|
// wait until the pods have been scheduler, i.e. are not Pending anymore. Remember
|
||||||
// that we cannot wait for the pods to be running because our pods terminate by themselves.
|
// that we cannot wait for the pods to be running because our pods terminate by themselves.
|
||||||
for _, ns := range namespaces {
|
for _, ns := range namespaces {
|
||||||
err := framework.WaitForPodNotPending(c, ns.Name, frontendPodName, "")
|
err := framework.WaitForPodNotPending(c, ns.Name, frontendPodName)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
|
|||||||
By("creating secret and pod")
|
By("creating secret and pod")
|
||||||
framework.RunKubectlOrDie("create", "-f", filepath.Join(framework.TestContext.OutputDir, secretYaml), nsFlag)
|
framework.RunKubectlOrDie("create", "-f", filepath.Join(framework.TestContext.OutputDir, secretYaml), nsFlag)
|
||||||
framework.RunKubectlOrDie("create", "-f", filepath.Join(framework.TestContext.OutputDir, podYaml), nsFlag)
|
framework.RunKubectlOrDie("create", "-f", filepath.Join(framework.TestContext.OutputDir, podYaml), nsFlag)
|
||||||
err := framework.WaitForPodNoLongerRunningInNamespace(c, podName, ns, "")
|
err := framework.WaitForPodNoLongerRunningInNamespace(c, podName, ns)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
By("checking if secret was read correctly")
|
By("checking if secret was read correctly")
|
||||||
@ -482,7 +482,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
|
|||||||
|
|
||||||
By("creating the pod")
|
By("creating the pod")
|
||||||
framework.RunKubectlOrDie("create", "-f", filepath.Join(framework.TestContext.OutputDir, podYaml), nsFlag)
|
framework.RunKubectlOrDie("create", "-f", filepath.Join(framework.TestContext.OutputDir, podYaml), nsFlag)
|
||||||
err := framework.WaitForPodNoLongerRunningInNamespace(c, podName, ns, "")
|
err := framework.WaitForPodNoLongerRunningInNamespace(c, podName, ns)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
By("checking if name and namespace were passed correctly")
|
By("checking if name and namespace were passed correctly")
|
||||||
|
@ -369,19 +369,19 @@ func (f *Framework) WaitForPodRunning(podName string) error {
|
|||||||
|
|
||||||
// WaitForPodReady waits for the pod to flip to ready in the namespace.
|
// WaitForPodReady waits for the pod to flip to ready in the namespace.
|
||||||
func (f *Framework) WaitForPodReady(podName string) error {
|
func (f *Framework) WaitForPodReady(podName string) error {
|
||||||
return waitTimeoutForPodReadyInNamespace(f.ClientSet, podName, f.Namespace.Name, "", PodStartTimeout)
|
return waitTimeoutForPodReadyInNamespace(f.ClientSet, podName, f.Namespace.Name, PodStartTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForPodRunningSlow waits for the pod to run in the namespace.
|
// WaitForPodRunningSlow waits for the pod to run in the namespace.
|
||||||
// It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).
|
// It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).
|
||||||
func (f *Framework) WaitForPodRunningSlow(podName string) error {
|
func (f *Framework) WaitForPodRunningSlow(podName string) error {
|
||||||
return waitForPodRunningInNamespaceSlow(f.ClientSet, podName, f.Namespace.Name, "")
|
return waitForPodRunningInNamespaceSlow(f.ClientSet, podName, f.Namespace.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForPodNoLongerRunning waits for the pod to no longer be running in the namespace, for either
|
// WaitForPodNoLongerRunning waits for the pod to no longer be running in the namespace, for either
|
||||||
// success or failure.
|
// success or failure.
|
||||||
func (f *Framework) WaitForPodNoLongerRunning(podName string) error {
|
func (f *Framework) WaitForPodNoLongerRunning(podName string) error {
|
||||||
return WaitForPodNoLongerRunningInNamespace(f.ClientSet, podName, f.Namespace.Name, "")
|
return WaitForPodNoLongerRunningInNamespace(f.ClientSet, podName, f.Namespace.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestContainerOutput runs the given pod in the given namespace and waits
|
// TestContainerOutput runs the given pod in the given namespace and waits
|
||||||
|
@ -1208,30 +1208,27 @@ func CheckInvariants(events []watch.Event, fns ...InvariantFunc) error {
|
|||||||
// Waits default amount of time (PodStartTimeout) for the specified pod to become running.
|
// Waits default amount of time (PodStartTimeout) for the specified pod to become running.
|
||||||
// Returns an error if timeout occurs first, or pod goes in to failed state.
|
// Returns an error if timeout occurs first, or pod goes in to failed state.
|
||||||
func WaitForPodRunningInNamespace(c clientset.Interface, pod *v1.Pod) error {
|
func WaitForPodRunningInNamespace(c clientset.Interface, pod *v1.Pod) error {
|
||||||
// this short-cicuit is needed for cases when we pass a list of pods instead
|
|
||||||
// of newly created pod (e.g. VerifyPods) which means we are getting already
|
|
||||||
// running pod for which waiting does not make sense and will always fail
|
|
||||||
if pod.Status.Phase == v1.PodRunning {
|
if pod.Status.Phase == v1.PodRunning {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return waitTimeoutForPodRunningInNamespace(c, pod.Name, pod.Namespace, pod.ResourceVersion, PodStartTimeout)
|
return waitTimeoutForPodRunningInNamespace(c, pod.Name, pod.Namespace, PodStartTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waits default amount of time (PodStartTimeout) for the specified pod to become running.
|
// Waits default amount of time (PodStartTimeout) for the specified pod to become running.
|
||||||
// Returns an error if timeout occurs first, or pod goes in to failed state.
|
// Returns an error if timeout occurs first, or pod goes in to failed state.
|
||||||
func WaitForPodNameRunningInNamespace(c clientset.Interface, podName, namespace string) error {
|
func WaitForPodNameRunningInNamespace(c clientset.Interface, podName, namespace string) error {
|
||||||
return waitTimeoutForPodRunningInNamespace(c, podName, namespace, "", PodStartTimeout)
|
return waitTimeoutForPodRunningInNamespace(c, podName, namespace, PodStartTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waits an extended amount of time (slowPodStartTimeout) for the specified pod to become running.
|
// Waits an extended amount of time (slowPodStartTimeout) for the specified pod to become running.
|
||||||
// The resourceVersion is used when Watching object changes, it tells since when we care
|
// The resourceVersion is used when Watching object changes, it tells since when we care
|
||||||
// about changes to the pod. Returns an error if timeout occurs first, or pod goes in to failed state.
|
// about changes to the pod. Returns an error if timeout occurs first, or pod goes in to failed state.
|
||||||
func waitForPodRunningInNamespaceSlow(c clientset.Interface, podName, namespace, resourceVersion string) error {
|
func waitForPodRunningInNamespaceSlow(c clientset.Interface, podName, namespace string) error {
|
||||||
return waitTimeoutForPodRunningInNamespace(c, podName, namespace, resourceVersion, slowPodStartTimeout)
|
return waitTimeoutForPodRunningInNamespace(c, podName, namespace, slowPodStartTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespace, resouceVersion string, timeout time.Duration) error {
|
func waitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error {
|
||||||
return wait.PollImmediate(10*time.Millisecond, timeout, podRunning(c, podName, namespace))
|
return wait.PollImmediate(Poll, timeout, podRunning(c, podName, namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
func podRunning(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
func podRunning(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||||
@ -1252,12 +1249,12 @@ func podRunning(c clientset.Interface, podName, namespace string) wait.Condition
|
|||||||
|
|
||||||
// Waits default amount of time (podNoLongerRunningTimeout) for the specified pod to stop running.
|
// Waits default amount of time (podNoLongerRunningTimeout) for the specified pod to stop running.
|
||||||
// Returns an error if timeout occurs first.
|
// Returns an error if timeout occurs first.
|
||||||
func WaitForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace, resourceVersion string) error {
|
func WaitForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace string) error {
|
||||||
return WaitTimeoutForPodNoLongerRunningInNamespace(c, podName, namespace, resourceVersion, podNoLongerRunningTimeout)
|
return WaitTimeoutForPodNoLongerRunningInNamespace(c, podName, namespace, podNoLongerRunningTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func WaitTimeoutForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace, resourceVersion string, timeout time.Duration) error {
|
func WaitTimeoutForPodNoLongerRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error {
|
||||||
return wait.PollImmediate(10*time.Millisecond, timeout, podCompleted(c, podName, namespace))
|
return wait.PollImmediate(Poll, timeout, podCompleted(c, podName, namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
func podCompleted(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
func podCompleted(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||||
@ -1274,8 +1271,8 @@ func podCompleted(c clientset.Interface, podName, namespace string) wait.Conditi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitTimeoutForPodReadyInNamespace(c clientset.Interface, podName, namespace, resourceVersion string, timeout time.Duration) error {
|
func waitTimeoutForPodReadyInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error {
|
||||||
return wait.PollImmediate(10*time.Millisecond, timeout, podRunningAndReady(c, podName, namespace))
|
return wait.PollImmediate(Poll, timeout, podRunningAndReady(c, podName, namespace))
|
||||||
}
|
}
|
||||||
|
|
||||||
func podRunningAndReady(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
func podRunningAndReady(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||||
@ -1297,8 +1294,8 @@ func podRunningAndReady(c clientset.Interface, podName, namespace string) wait.C
|
|||||||
// WaitForPodNotPending returns an error if it took too long for the pod to go out of pending state.
|
// WaitForPodNotPending returns an error if it took too long for the pod to go out of pending state.
|
||||||
// The resourceVersion is used when Watching object changes, it tells since when we care
|
// The resourceVersion is used when Watching object changes, it tells since when we care
|
||||||
// about changes to the pod.
|
// about changes to the pod.
|
||||||
func WaitForPodNotPending(c clientset.Interface, ns, podName, resourceVersion string) error {
|
func WaitForPodNotPending(c clientset.Interface, ns, podName string) error {
|
||||||
return wait.PollImmediate(10*time.Millisecond, PodStartTimeout, podNotPending(c, podName, ns))
|
return wait.PollImmediate(Poll, PodStartTimeout, podNotPending(c, podName, ns))
|
||||||
}
|
}
|
||||||
|
|
||||||
func podNotPending(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
func podNotPending(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||||
|
@ -420,7 +420,7 @@ var _ = framework.KubeDescribe("Network Partition [Disruptive] [Slow]", func() {
|
|||||||
// The grace period on the stateful pods is set to a value > 0.
|
// The grace period on the stateful pods is set to a value > 0.
|
||||||
testUnderTemporaryNetworkFailure(c, ns, node, func() {
|
testUnderTemporaryNetworkFailure(c, ns, node, func() {
|
||||||
framework.Logf("Checking that the NodeController does not force delete stateful pods %v", pod.Name)
|
framework.Logf("Checking that the NodeController does not force delete stateful pods %v", pod.Name)
|
||||||
err := framework.WaitTimeoutForPodNoLongerRunningInNamespace(c, pod.Name, ns, pod.ResourceVersion, 10*time.Minute)
|
err := framework.WaitTimeoutForPodNoLongerRunningInNamespace(c, pod.Name, ns, 10*time.Minute)
|
||||||
Expect(err).To(Equal(wait.ErrWaitTimeout), "Pod was not deleted during network partition.")
|
Expect(err).To(Equal(wait.ErrWaitTimeout), "Pod was not deleted during network partition.")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
|
|
||||||
By("Trying to relaunch the pod, now with labels.")
|
By("Trying to relaunch the pod, now with labels.")
|
||||||
labelPodName := "with-labels"
|
labelPodName := "with-labels"
|
||||||
pod := createPausePod(f, pausePodConfig{
|
_ = createPausePod(f, pausePodConfig{
|
||||||
Name: labelPodName,
|
Name: labelPodName,
|
||||||
NodeSelector: map[string]string{
|
NodeSelector: map[string]string{
|
||||||
"kubernetes.io/hostname": nodeName,
|
"kubernetes.io/hostname": nodeName,
|
||||||
@ -285,7 +285,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new label yet. The
|
// already when the kubelet does not know about its new label yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName))
|
||||||
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
@ -346,7 +346,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
|
|
||||||
By("Trying to relaunch the pod, now with labels.")
|
By("Trying to relaunch the pod, now with labels.")
|
||||||
labelPodName := "with-labels"
|
labelPodName := "with-labels"
|
||||||
pod := createPausePod(f, pausePodConfig{
|
_ = createPausePod(f, pausePodConfig{
|
||||||
Name: labelPodName,
|
Name: labelPodName,
|
||||||
Affinity: &v1.Affinity{
|
Affinity: &v1.Affinity{
|
||||||
NodeAffinity: &v1.NodeAffinity{
|
NodeAffinity: &v1.NodeAffinity{
|
||||||
@ -376,7 +376,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new label yet. The
|
// already when the kubelet does not know about its new label yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName))
|
||||||
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
@ -462,7 +462,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
|
|
||||||
By("Trying to launch the pod, now with podAffinity.")
|
By("Trying to launch the pod, now with podAffinity.")
|
||||||
labelPodName := "with-podaffinity-" + string(uuid.NewUUID())
|
labelPodName := "with-podaffinity-" + string(uuid.NewUUID())
|
||||||
pod := createPausePod(f, pausePodConfig{
|
_ = createPausePod(f, pausePodConfig{
|
||||||
Name: labelPodName,
|
Name: labelPodName,
|
||||||
Affinity: &v1.Affinity{
|
Affinity: &v1.Affinity{
|
||||||
PodAffinity: &v1.PodAffinity{
|
PodAffinity: &v1.PodAffinity{
|
||||||
@ -490,7 +490,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new label yet. The
|
// already when the kubelet does not know about its new label yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName))
|
||||||
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
@ -573,7 +573,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
|
|
||||||
By("Trying to launch the pod, now with multiple pod affinities with diff LabelOperators.")
|
By("Trying to launch the pod, now with multiple pod affinities with diff LabelOperators.")
|
||||||
labelPodName := "with-podaffinity-" + string(uuid.NewUUID())
|
labelPodName := "with-podaffinity-" + string(uuid.NewUUID())
|
||||||
pod := createPausePod(f, pausePodConfig{
|
_ = createPausePod(f, pausePodConfig{
|
||||||
Name: labelPodName,
|
Name: labelPodName,
|
||||||
Affinity: &v1.Affinity{
|
Affinity: &v1.Affinity{
|
||||||
PodAffinity: &v1.PodAffinity{
|
PodAffinity: &v1.PodAffinity{
|
||||||
@ -607,7 +607,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new label yet. The
|
// already when the kubelet does not know about its new label yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, labelPodName))
|
||||||
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
labelPod, err := cs.Core().Pods(ns).Get(labelPodName, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
@ -632,7 +632,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new label yet. The
|
// already when the kubelet does not know about its new label yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, pod.Name, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, pod.Name))
|
||||||
labelPod, err := cs.Core().Pods(ns).Get(pod.Name, metav1.GetOptions{})
|
labelPod, err := cs.Core().Pods(ns).Get(pod.Name, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
@ -656,7 +656,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new label yet. The
|
// already when the kubelet does not know about its new label yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, pod.Name, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, pod.Name))
|
||||||
labelPod, err := cs.Core().Pods(ns).Get(pod.Name, metav1.GetOptions{})
|
labelPod, err := cs.Core().Pods(ns).Get(pod.Name, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(labelPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
@ -688,7 +688,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
|
|
||||||
By("Trying to relaunch the pod, now with tolerations.")
|
By("Trying to relaunch the pod, now with tolerations.")
|
||||||
tolerationPodName := "with-tolerations"
|
tolerationPodName := "with-tolerations"
|
||||||
pod := createPausePod(f, pausePodConfig{
|
_ = createPausePod(f, pausePodConfig{
|
||||||
Name: tolerationPodName,
|
Name: tolerationPodName,
|
||||||
Annotations: map[string]string{
|
Annotations: map[string]string{
|
||||||
"scheduler.alpha.kubernetes.io/tolerations": `
|
"scheduler.alpha.kubernetes.io/tolerations": `
|
||||||
@ -708,7 +708,7 @@ var _ = framework.KubeDescribe("SchedulerPredicates [Serial]", func() {
|
|||||||
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
// kubelet and the scheduler: the scheduler might have scheduled a pod
|
||||||
// already when the kubelet does not know about its new taint yet. The
|
// already when the kubelet does not know about its new taint yet. The
|
||||||
// kubelet will then refuse to launch the pod.
|
// kubelet will then refuse to launch the pod.
|
||||||
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, tolerationPodName, pod.ResourceVersion))
|
framework.ExpectNoError(framework.WaitForPodNotPending(cs, ns, tolerationPodName))
|
||||||
deployedPod, err := cs.Core().Pods(ns).Get(tolerationPodName, metav1.GetOptions{})
|
deployedPod, err := cs.Core().Pods(ns).Get(tolerationPodName, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
Expect(deployedPod.Spec.NodeName).To(Equal(nodeName))
|
Expect(deployedPod.Spec.NodeName).To(Equal(nodeName))
|
||||||
|
@ -144,7 +144,7 @@ func runAppArmorTest(f *framework.Framework, shouldRun bool, profile string) v1.
|
|||||||
if shouldRun {
|
if shouldRun {
|
||||||
// The pod needs to start before it stops, so wait for the longer start timeout.
|
// The pod needs to start before it stops, so wait for the longer start timeout.
|
||||||
framework.ExpectNoError(framework.WaitTimeoutForPodNoLongerRunningInNamespace(
|
framework.ExpectNoError(framework.WaitTimeoutForPodNoLongerRunningInNamespace(
|
||||||
f.ClientSet, pod.Name, f.Namespace.Name, "", framework.PodStartTimeout))
|
f.ClientSet, pod.Name, f.Namespace.Name, framework.PodStartTimeout))
|
||||||
} else {
|
} else {
|
||||||
// Pod should remain in the pending state. Wait for the Reason to be set to "AppArmor".
|
// Pod should remain in the pending state. Wait for the Reason to be set to "AppArmor".
|
||||||
w, err := f.PodClient().Watch(metav1.SingleObject(metav1.ObjectMeta{Name: pod.Name}))
|
w, err := f.PodClient().Watch(metav1.SingleObject(metav1.ObjectMeta{Name: pod.Name}))
|
||||||
|
@ -51,7 +51,7 @@ var _ = framework.KubeDescribe("ImageID", func() {
|
|||||||
pod := f.PodClient().Create(podDesc)
|
pod := f.PodClient().Create(podDesc)
|
||||||
|
|
||||||
framework.ExpectNoError(framework.WaitTimeoutForPodNoLongerRunningInNamespace(
|
framework.ExpectNoError(framework.WaitTimeoutForPodNoLongerRunningInNamespace(
|
||||||
f.ClientSet, pod.Name, f.Namespace.Name, "", framework.PodStartTimeout))
|
f.ClientSet, pod.Name, f.Namespace.Name, framework.PodStartTimeout))
|
||||||
runningPod, err := f.PodClient().Get(pod.Name, metav1.GetOptions{})
|
runningPod, err := f.PodClient().Get(pod.Name, metav1.GetOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user