@@ -22,35 +22,29 @@ import (
22
22
. "github.com/onsi/gomega"
23
23
mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1"
24
24
25
- batchv1 "k8s.io/api/batch/v1"
26
- corev1 "k8s.io/api/core/v1"
27
-
28
25
. "github.com/project-codeflare/codeflare-operator/test/support"
29
26
)
30
27
31
28
func TestInstascaleMachinePool (t * testing.T ) {
32
-
33
29
test := With (t )
34
30
test .T ().Parallel ()
35
31
36
- if ! IsOsd (test ) {
32
+ if ! IsOsd () {
37
33
test .T ().Skip ("Skipping test as not running on an OSD cluster" )
38
34
}
39
35
40
36
namespace := test .NewTestNamespace ()
41
37
42
38
// Test configuration
43
- testConfigData := map [string ][]byte {
39
+ cm := CreateConfigMap ( test , namespace . Name , map [string ][]byte {
44
40
// pip requirements
45
41
"requirements.txt" : ReadFile (test , "mnist_pip_requirements.txt" ),
46
42
// MNIST training script
47
43
"mnist.py" : ReadFile (test , "mnist.py" ),
48
- }
49
- cm := CreateConfigMap (test , namespace .Name , testConfigData )
44
+ })
50
45
51
46
//create OCM connection
52
47
connection := CreateOCMConnection (test )
53
-
54
48
defer connection .Close ()
55
49
56
50
// check existing cluster machine pool resources
@@ -59,25 +53,18 @@ func TestInstascaleMachinePool(t *testing.T) {
59
53
ShouldNot (ContainElement (WithTransform (MachinePoolId , Equal ("test-instascale-g4dn-xlarge" ))))
60
54
61
55
// Setup batch job and AppWrapper
62
- job , aw , err := createInstaScaleJobAppWrapper (test , namespace , cm )
56
+ _ , aw , err := createInstaScaleJobAppWrapper (test , namespace , cm )
63
57
test .Expect (err ).NotTo (HaveOccurred ())
58
+ test .T ().Logf ("AppWrapper created successfully %s/%s" , aw .Namespace , aw .Name )
59
+
60
+ // assert that AppWrapper goes to "Running" state
61
+ test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutGpuProvisioning ).
62
+ Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateActive )))
64
63
65
64
// look for machine pool with aw name - expect to find it
66
65
test .Eventually (MachinePools (test , connection ), TestTimeoutLong ).
67
66
Should (ContainElement (WithTransform (MachinePoolId , Equal ("test-instascale-g4dn-xlarge" ))))
68
67
69
- // Assert that the job has completed
70
- test .T ().Logf ("Waiting for Job %s/%s to complete" , job .Namespace , job .Name )
71
- test .Eventually (Job (test , job .Namespace , job .Name ), TestTimeoutLong ).Should (
72
- Or (
73
- WithTransform (ConditionStatus (batchv1 .JobComplete ), Equal (corev1 .ConditionTrue )),
74
- WithTransform (ConditionStatus (batchv1 .JobFailed ), Equal (corev1 .ConditionTrue )),
75
- ))
76
-
77
- // Assert the job has completed successfully
78
- test .Expect (GetJob (test , job .Namespace , job .Name )).
79
- To (WithTransform (ConditionStatus (batchv1 .JobComplete ), Equal (corev1 .ConditionTrue )))
80
-
81
68
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutShort ).
82
69
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateCompleted )))
83
70
0 commit comments