Skip to content

speed up build #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 7 additions & 54 deletions test/e2e/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
if pass {
break
} else {
time.Sleep(1 * time.Minute)
time.Sleep(30 * time.Second)
}
}

Expand Down Expand Up @@ -581,14 +581,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
aw := createGenericJobAWWithStatus(context, "aw-test-job-with-comp-1")
err1 := waitAWPodsReady(context, aw)
Expect(err1).NotTo(HaveOccurred())
time.Sleep(1 * time.Minute)
aw1, err := context.karclient.McadV1beta1().AppWrappers(aw.Namespace).Get(context.ctx, aw.Name, metav1.GetOptions{})
if err != nil {
fmt.Fprintf(GinkgoWriter, "Error getting status, %v\n", err)
}
Expect(err).Should(Succeed())
Expect(aw1.Status.State).To(Equal(arbv1.AppWrapperStateCompleted))
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
Eventually(AppWrapper(context, aw.Namespace, aw.Name), 2*time.Minute).Should(WithTransform(AppWrapperState, Equal(arbv1.AppWrapperStateCompleted)))
appwrappers = append(appwrappers, aw)
fmt.Fprintf(os.Stdout, "[e2e] MCAD Job Completion Test - Completed.\n")
})
Expand All @@ -603,13 +596,9 @@ var _ = Describe("AppWrapper E2E Test", func() {
aw := createGenericJobAWWithMultipleStatus(context, "aw-test-job-with-comp-ms-21")
err1 := waitAWPodsReady(context, aw)
Expect(err1).NotTo(HaveOccurred(), "Expecting pods to be ready for app wrapper: 'aw-test-job-with-comp-ms-21'")
time.Sleep(1 * time.Minute)
aw1, err := context.karclient.McadV1beta1().AppWrappers(aw.Namespace).Get(context.ctx, aw.Name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred(), "No error is expected when getting status")
fmt.Fprintf(GinkgoWriter, "[e2e] MCAD Multi-Item Job Completion Test status of AW %v.\n", aw1.Status)
Expect(aw1.Status.State).To(Equal(arbv1.AppWrapperStateCompleted), "Expecting a completed app wrapper status")
Eventually(AppWrapper(context, aw.Namespace, aw.Name), 2*time.Minute).Should(WithTransform(AppWrapperState, Equal(arbv1.AppWrapperStateCompleted)))
appwrappers = append(appwrappers, aw)
fmt.Fprintf(os.Stdout, "[e2e] MCAD Job Completion Test - Completed.\n")
fmt.Fprintf(os.Stdout, "[e2e] MCAD Multi-Item Job Completion Test - Completed.\n")
})

It("MCAD GenericItem Without Status Test", func() {
Expand Down Expand Up @@ -661,17 +650,7 @@ var _ = Describe("AppWrapper E2E Test", func() {
aw := createGenericJobAWtWithLargeCompute(context, "aw-test-job-with-large-comp-1")
err1 := waitAWPodsReady(context, aw)
Expect(err1).NotTo(HaveOccurred())
time.Sleep(1 * time.Minute)
aw1, err := context.karclient.McadV1beta1().AppWrappers(aw.Namespace).Get(context.ctx, aw.Name, metav1.GetOptions{})
if err != nil {
fmt.Fprintf(GinkgoWriter, "Error getting status, %v", err)
}
pass := false
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
if aw1.Status.State == arbv1.AppWrapperStateEnqueued {
pass = true
}
Expect(pass).To(BeTrue())
Eventually(AppWrapper(context, aw.Namespace, aw.Name), 2*time.Minute).Should(WithTransform(AppWrapperState, Equal(arbv1.AppWrapperStateEnqueued)))
appwrappers = append(appwrappers, aw)
fmt.Fprintf(os.Stdout, "[e2e] MCAD Job Large Compute Requirement Test - Completed.\n")

Expand Down Expand Up @@ -708,25 +687,9 @@ var _ = Describe("AppWrapper E2E Test", func() {

aw := createGenericDeploymentAWWithMultipleItems(context, "aw-deployment-rhc")
appwrappers = append(appwrappers, aw)
time.Sleep(30 * time.Second)
err1 := waitAWPodsReady(context, aw)
Expect(err1).NotTo(HaveOccurred(), "Expecting pods to be ready for app wrapper: aw-deployment-rhc")
aw1, err := context.karclient.McadV1beta1().AppWrappers(aw.Namespace).Get(context.ctx, aw.Name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred(), "Expecting to get app wrapper status")
pass := false
for true {
aw1, err := context.karclient.McadV1beta1().AppWrappers(aw.Namespace).Get(context.ctx, aw.Name, metav1.GetOptions{})
if err != nil {
fmt.Fprint(GinkgoWriter, "Error getting status")
}
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
if aw1.Status.State == arbv1.AppWrapperStateRunningHoldCompletion {
pass = true
break
}
}
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
Expect(pass).To(BeTrue())
Eventually(AppWrapper(context, aw.Namespace, aw.Name), 2*time.Minute).Should(WithTransform(AppWrapperState, Equal(arbv1.AppWrapperStateRunningHoldCompletion)))
fmt.Fprintf(os.Stdout, "[e2e] MCAD Deployment RuningHoldCompletion Test - Completed. Awaiting app wrapper cleanup.\n")
})

Expand All @@ -738,19 +701,9 @@ var _ = Describe("AppWrapper E2E Test", func() {
defer cleanupTestObjectsPtr(context, appwrappersPtr)

aw := createGenericServiceAWWithNoStatus(context, appendRandomString("aw-deployment-2-status"))
time.Sleep(1 * time.Minute)
err1 := waitAWPodsReady(context, aw)
Expect(err1).NotTo(HaveOccurred())
aw1, err := context.karclient.McadV1beta1().AppWrappers(aw.Namespace).Get(context.ctx, aw.Name, metav1.GetOptions{})
if err != nil {
fmt.Fprintf(GinkgoWriter, "Error getting status, %v", err)
}
pass := false
fmt.Fprintf(GinkgoWriter, "[e2e] status of AW %v.\n", aw1.Status.State)
if aw1.Status.State == arbv1.AppWrapperStateActive {
pass = true
}
Expect(pass).To(BeTrue())
Eventually(AppWrapper(context, aw.Namespace, aw.Name), 2*time.Minute).Should(WithTransform(AppWrapperState, Equal(arbv1.AppWrapperStateActive)))
appwrappers = append(appwrappers, aw)
fmt.Fprintf(os.Stdout, "[e2e] MCAD Service no RuningHoldCompletion or Complete Test - Completed.\n")

Expand Down
13 changes: 13 additions & 0 deletions test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"time"

. "github.com/onsi/ginkgo"
"github.com/onsi/gomega"
. "github.com/onsi/gomega"

v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -2691,3 +2692,15 @@ func appendRandomString(value string) string {
}
return fmt.Sprintf("%s-%s", value, string(b))
}

func AppWrapper(context *context, namespace string, name string) func(g gomega.Gomega) *arbv1.AppWrapper {
return func(g gomega.Gomega) *arbv1.AppWrapper {
aw, err := context.karclient.McadV1beta1().AppWrappers(namespace).Get(context.ctx, name, metav1.GetOptions{})
g.Expect(err).NotTo(gomega.HaveOccurred())
return aw
}
}

func AppWrapperState(aw *arbv1.AppWrapper) arbv1.AppWrapperState {
return aw.Status.State
}