6
6
. "github.com/onsi/gomega"
7
7
mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1"
8
8
9
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
10
+
9
11
. "github.com/project-codeflare/codeflare-operator/test/support"
10
12
)
11
13
@@ -29,27 +31,30 @@ func TestInstascaleMachineSet(t *testing.T) {
29
31
"mnist.py" : ReadFile (test , "mnist.py" ),
30
32
})
31
33
34
+ // // Setup batch job and AppWrapper
35
+ aw := instaScaleJobAppWrapper (test , namespace , cm )
36
+
32
37
// look for machine set with aw name - expect to find it
33
- test .Expect (GetMachineSets (test )).Should (ContainElement (WithTransform (MachineSetId , Equal ("test-instascale" ))))
38
+ test .Expect (GetMachineSets (test )).Should (ContainElement (WithTransform (MachineSetId , Equal (aw . Name ))))
34
39
// look for machine belonging to the machine set, there should be none
35
- test .Expect (GetMachines (test , "test-instascale" )).Should (BeEmpty ())
40
+ test .Expect (GetMachines (test , aw . Name )).Should (BeEmpty ())
36
41
37
- // // Setup batch job and AppWrapper
38
- _ , aw , err := createInstaScaleJobAppWrapper ( test , namespace , cm )
42
+ // apply AppWrapper to cluster
43
+ _ , err := test . Client (). MCAD (). WorkloadV1beta1 (). AppWrappers ( namespace . Name ). Create ( test . Ctx (), aw , metav1. CreateOptions {} )
39
44
test .Expect (err ).NotTo (HaveOccurred ())
40
45
41
46
// assert that AppWrapper goes to "Running" state
42
47
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutGpuProvisioning ).
43
48
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateActive )))
44
49
45
50
// look for machine belonging to the machine set - expect to find it
46
- test .Eventually (Machines (test , "test-instascale" ), TestTimeoutLong ).Should (HaveLen (1 ))
51
+ test .Eventually (Machines (test , aw . Name ), TestTimeoutLong ).Should (HaveLen (1 ))
47
52
48
53
// assert that the AppWrapper goes to "Completed" state
49
54
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutMedium ).
50
55
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateCompleted )))
51
56
52
57
// look for machine belonging to the machine set - there should be none
53
- test .Eventually (Machines (test , "test-instascale" ), TestTimeoutLong ).Should (BeEmpty ())
58
+ test .Eventually (Machines (test , aw . Name ), TestTimeoutLong ).Should (BeEmpty ())
54
59
55
60
}
0 commit comments