@@ -17,6 +17,7 @@ limitations under the License.
1717package e2e
1818
1919import (
20+ "fmt"
2021 "testing"
2122
2223 . "github.com/onsi/gomega"
@@ -49,14 +50,15 @@ func TestInstascaleMachinePool(t *testing.T) {
4950 connection := CreateOCMConnection (test )
5051 defer connection .Close ()
5152
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-
5753 // Setup batch job and AppWrapper
5854 aw := instaScaleJobAppWrapper (test , namespace , cm )
5955
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+
6062 // apply AppWrapper to cluster
6163 _ , err := test .Client ().MCAD ().WorkloadV1beta1 ().AppWrappers (namespace .Name ).Create (test .Ctx (), aw , metav1.CreateOptions {})
6264 test .Expect (err ).NotTo (HaveOccurred ())
@@ -66,15 +68,15 @@ func TestInstascaleMachinePool(t *testing.T) {
6668 test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutGpuProvisioning ).
6769 Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateActive )))
6870
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
7072 test .Eventually (MachinePools (test , connection ), TestTimeoutLong ).
71- Should (ContainElement (WithTransform (MachinePoolId , Equal ( "test-instascale-g4dn-xlarge" ))))
73+ Should (ContainElement (WithTransform (MachinePoolLabels , HaveKey ( expectedLabel ))))
7274
7375 test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutShort ).
7476 Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateCompleted )))
7577
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
7779 test .Eventually (MachinePools (test , connection ), TestTimeoutLong ).
78- ShouldNot (ContainElement (WithTransform (MachinePoolId , Equal ( "test-instascale-g4dn-xlarge" ))))
80+ ShouldNot (ContainElement (WithTransform (MachinePoolLabels , HaveKey ( expectedLabel ))))
7981
8082}
0 commit comments