@@ -17,6 +17,7 @@ limitations under the License.
17
17
package e2e
18
18
19
19
import (
20
+ "fmt"
20
21
"testing"
21
22
22
23
. "github.com/onsi/gomega"
@@ -49,14 +50,15 @@ func TestInstascaleMachinePool(t *testing.T) {
49
50
connection := CreateOCMConnection (test )
50
51
defer connection .Close ()
51
52
52
- // check existing cluster machine pool resources
53
- // look for machine pool with aw name - expect not to find it
54
- test .Expect (GetMachinePools (test , connection )).
55
- ShouldNot (ContainElement (WithTransform (MachinePoolId , Equal ("test-instascale-g4dn-xlarge" ))))
56
-
57
53
// Setup batch job and AppWrapper
58
54
aw := instaScaleJobAppWrapper (test , namespace , cm )
59
55
56
+ expectedLabel := fmt .Sprintf ("%s-%s" , aw .Name , aw .Namespace )
57
+ // check existing cluster machine pool resources
58
+ // look for a machine pool with a label key equal to aw.name-aw.namespace - expect NOT to find it
59
+ test .Expect (GetMachinePools (test , connection )).
60
+ ShouldNot (ContainElement (WithTransform (MachinePoolLabels , HaveKey (expectedLabel ))))
61
+
60
62
// apply AppWrapper to cluster
61
63
_ , err := test .Client ().MCAD ().WorkloadV1beta1 ().AppWrappers (namespace .Name ).Create (test .Ctx (), aw , metav1.CreateOptions {})
62
64
test .Expect (err ).NotTo (HaveOccurred ())
@@ -66,15 +68,15 @@ func TestInstascaleMachinePool(t *testing.T) {
66
68
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutGpuProvisioning ).
67
69
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateActive )))
68
70
69
- // look for machine pool with aw name - expect to find it
71
+ // look for a machine pool with a label key equal to aw. name-aw.namespace - expect to find it
70
72
test .Eventually (MachinePools (test , connection ), TestTimeoutLong ).
71
- Should (ContainElement (WithTransform (MachinePoolId , Equal ( "test-instascale-g4dn-xlarge" ))))
73
+ Should (ContainElement (WithTransform (MachinePoolLabels , HaveKey ( expectedLabel ))))
72
74
73
75
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutShort ).
74
76
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateCompleted )))
75
77
76
- // look for machine pool with aw name - expect not to find it
78
+ // look for a machine pool with a label key equal to aw. name-aw.namespace - expect NOT to find it
77
79
test .Eventually (MachinePools (test , connection ), TestTimeoutLong ).
78
- ShouldNot (ContainElement (WithTransform (MachinePoolId , Equal ( "test-instascale-g4dn-xlarge" ))))
80
+ ShouldNot (ContainElement (WithTransform (MachinePoolLabels , HaveKey ( expectedLabel ))))
79
81
80
82
}
0 commit comments