This is an automated email from the ASF dual-hosted git repository.
ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
The following commit(s) were added to refs/heads/master by this push:
new 44d8c38e [YUNIKORN-2067] Test_With_Spark_Jobs e2e test wait for app
state Running after Spark job completed (#696)
44d8c38e is described below
commit 44d8c38e293bc3659254d5ead3f893ef9d960304
Author: Yu-Lin Chen <[email protected]>
AuthorDate: Thu Oct 26 11:20:56 2023 -0500
[YUNIKORN-2067] Test_With_Spark_Jobs e2e test wait for app state Running
after Spark job completed (#696)
Closes: #696
Signed-off-by: Craig Condit <[email protected]>
---
test/e2e/framework/helpers/k8s/k8s_utils.go | 19 +++++++++++++++++++
.../spark_jobs_scheduling_test.go | 8 ++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/test/e2e/framework/helpers/k8s/k8s_utils.go
b/test/e2e/framework/helpers/k8s/k8s_utils.go
index 7bf20667..8120d2ef 100644
--- a/test/e2e/framework/helpers/k8s/k8s_utils.go
+++ b/test/e2e/framework/helpers/k8s/k8s_utils.go
@@ -816,6 +816,25 @@ func (k *KubeCtl) WaitForPodBySelectorRunning(namespace
string, selector string,
return nil
}
+// Wait for all pods in 'namespace' with given 'selector' to enter succeeded
state.
+// Returns an error if no pods are found or not all discovered pods enter
succeeded state.
+func (k *KubeCtl) WaitForPodBySelectorSucceeded(namespace string, selector
string, timeout time.Duration) error {
+ podList, err := k.ListPods(namespace, selector)
+ if err != nil {
+ return err
+ }
+ if len(podList.Items) == 0 {
+ return fmt.Errorf("no pods in %s with selector %s", namespace,
selector)
+ }
+
+ for _, pod := range podList.Items {
+ if err := k.WaitForPodSucceeded(namespace, pod.Name, timeout);
err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// Wait up to timeout seconds for a pod in 'namespace' with given 'selector'
to exist
func (k *KubeCtl) WaitForPodBySelector(namespace string, selector string,
timeout time.Duration) error {
return wait.PollUntilContextTimeout(context.TODO(),
time.Millisecond*100, timeout, false, k.isPodSelectorInNs(selector,
namespace).WithContext())
diff --git a/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
b/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
index 375e9f9a..a28e14db 100644
--- a/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
+++ b/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_test.go
@@ -144,8 +144,12 @@ var _ = Describe("", func() {
// Verify that all the spark jobs are scheduled and are in
running state.
for _, id := range appIds {
- By(fmt.Sprintf("Verify if app: %s is in running state",
id))
- err = restClient.WaitForAppStateTransition("default",
"root."+sparkNS, id, yunikorn.States().Application.Running, 360)
+ By(fmt.Sprintf("Verify driver pod for application %s
has been created.", id))
+ err = kClient.WaitForPodBySelector(sparkNS,
fmt.Sprintf("spark-app-selector=%s, spark-role=driver", id), 180*time.Second)
+ Ω(err).ShouldNot(HaveOccurred())
+
+ By(fmt.Sprintf("Verify driver pod for application %s
was completed.", id))
+ err = kClient.WaitForPodBySelectorSucceeded(sparkNS,
fmt.Sprintf("spark-app-selector=%s, spark-role=driver", id), 360*time.Second)
Ω(err).NotTo(HaveOccurred())
}
})
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]