@@ -17,25 +17,85 @@ limitations under the License.
1717package e2e
1818
1919import (
20+ "time"
21+
2022 . "github.com/onsi/ginkgo/v2"
21- // . "github.com/onsi/gomega"
23+ . "github.com/onsi/gomega"
2224
23- awv1b2 "github.com/project-codeflare/appwrapper/api/v1beta2"
25+ workloadv1beta2 "github.com/project-codeflare/appwrapper/api/v1beta2"
2426)
2527
2628var _ = Describe ("AppWrapper E2E Test" , func () {
27- var appwrappers []* awv1b2 .AppWrapper
29+ var appwrappers []* workloadv1beta2 .AppWrapper
2830
2931 BeforeEach (func () {
30- appwrappers = []* awv1b2 .AppWrapper {}
32+ appwrappers = []* workloadv1beta2 .AppWrapper {}
3133 })
3234
3335 AfterEach (func () {
3436 By ("Cleaning up test objects" )
3537 cleanupTestObjects (ctx , appwrappers )
3638 })
3739
38- It ("Dummy Test" , func () {
39- By ("Testing nothing of interest..." )
40+ Describe ("Creation of Fundamental GVKs" , func () {
41+ It ("Pods" , func () {
42+ aw := createAppWrapper (ctx , pod (250 ), pod (250 ))
43+ appwrappers = append (appwrappers , aw )
44+ Expect (waitAWPodsReady (ctx , aw )).Should (Succeed ())
45+ })
46+ It ("Deployments" , func () {
47+ aw := createAppWrapper (ctx , deployment (2 , 200 ))
48+ appwrappers = append (appwrappers , aw )
49+ Expect (waitAWPodsReady (ctx , aw )).Should (Succeed ())
50+ })
51+ It ("StatefulSets" , func () {
52+ aw := createAppWrapper (ctx , statefulset (2 , 200 ))
53+ appwrappers = append (appwrappers , aw )
54+ Expect (waitAWPodsReady (ctx , aw )).Should (Succeed ())
55+ })
56+ // TODO: Batch v1.Jobs
57+ It ("Mixed Basic Resources" , func () {
58+ aw := createAppWrapper (ctx , pod (100 ), deployment (2 , 100 ), statefulset (2 , 100 ), service ())
59+ appwrappers = append (appwrappers , aw )
60+ Expect (waitAWPodsReady (ctx , aw )).Should (Succeed ())
61+ })
62+ })
63+
64+ Describe ("Error Handling for Invalid Resources" , func () {
65+ // TODO: Replicate scenarios from the AdmissionController unit tests
66+
67+ })
68+
69+ Describe ("Queueing and Preemption" , func () {
70+ It ("Basic Queuing" , Label ("slow" ), func () {
71+ By ("Jobs should be admitted when there is available quota" )
72+ aw := createAppWrapper (ctx , deployment (2 , 500 ))
73+ appwrappers = append (appwrappers , aw )
74+ Expect (waitAWPodsReady (ctx , aw )).Should (Succeed ())
75+ aw2 := createAppWrapper (ctx , deployment (2 , 500 ))
76+ appwrappers = append (appwrappers , aw2 )
77+ Expect (waitAWPodsReady (ctx , aw2 )).Should (Succeed ())
78+
79+ By ("Jobs should be queued when quota is exhausted" )
80+ aw3 := createAppWrapper (ctx , deployment (2 , 250 ))
81+ appwrappers = append (appwrappers , aw3 )
82+ Eventually (AppWrapperPhase (ctx , aw3 ), 10 * time .Second ).Should (Equal (workloadv1beta2 .AppWrapperSuspended ))
83+ Consistently (AppWrapperPhase (ctx , aw3 ), 20 * time .Second ).Should (Equal (workloadv1beta2 .AppWrapperSuspended ))
84+
85+ By ("Queued job is admitted when quota becomes available" )
86+ Expect (deleteAppWrapper (ctx , aw .Name , aw .Namespace )).Should (Succeed ())
87+ appwrappers = []* workloadv1beta2.AppWrapper {aw2 , aw3 }
88+ Expect (waitAWPodsReady (ctx , aw3 )).Should (Succeed ())
89+ })
90+
91+ })
92+
93+ Describe ("Detection of Completion Status" , func () {
94+
95+ })
96+
97+ Describe ("Load Testing" , Label ("slow" ), func () {
98+
4099 })
100+
41101})
0 commit comments