1
1
package e2e
2
2
3
3
import (
4
+ "fmt"
4
5
"testing"
5
6
6
7
. "github.com/onsi/gomega"
@@ -34,14 +35,15 @@ func TestInstascaleNodepool(t *testing.T) {
34
35
connection := CreateOCMConnection (test )
35
36
defer connection .Close ()
36
37
37
- // check existing cluster resources
38
- // look for a node pool with a label key equal to aw name - expect NOT to find it
39
- test .Expect (GetNodePools (test , connection )).
40
- ShouldNot (ContainElement (WithTransform (NodePoolLabels , HaveKey (HavePrefix ("test-instascale" )))))
41
-
42
38
// Setup batch job and AppWrapper
43
39
aw := instaScaleJobAppWrapper (test , namespace , cm )
44
40
41
+ expectedLabel := fmt .Sprintf ("%s-%s" , aw .Name , aw .Namespace )
42
+ // check existing cluster resources
43
+ // look for a node pool with a label key equal to aw.Name-aw.Namespace - expect NOT to find it
44
+ test .Expect (GetNodePools (test , connection )).
45
+ ShouldNot (ContainElement (WithTransform (NodePoolLabels , HaveKey (expectedLabel ))))
46
+
45
47
// apply AppWrapper to cluster
46
48
_ , err := test .Client ().MCAD ().WorkloadV1beta1 ().AppWrappers (namespace .Name ).Create (test .Ctx (), aw , metav1.CreateOptions {})
47
49
test .Expect (err ).NotTo (HaveOccurred ())
@@ -51,16 +53,16 @@ func TestInstascaleNodepool(t *testing.T) {
51
53
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutGpuProvisioning ).
52
54
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateActive )))
53
55
54
- // look for a node pool with a label key equal to aw name - expect to find it
56
+ // look for a node pool with a label key equal to aw.Name-aw.Namespace - expect to find it
55
57
test .Eventually (NodePools (test , connection ), TestTimeoutLong ).
56
- Should (ContainElement (WithTransform (NodePoolLabels , HaveKey (HavePrefix ( "test-instascale" ) ))))
58
+ Should (ContainElement (WithTransform (NodePoolLabels , HaveKey (expectedLabel ))))
57
59
58
60
// assert that the AppWrapper goes to "Completed" state
59
61
test .Eventually (AppWrapper (test , namespace , aw .Name ), TestTimeoutLong ).
60
62
Should (WithTransform (AppWrapperState , Equal (mcadv1beta1 .AppWrapperStateCompleted )))
61
63
62
- // look for a node pool with a label key equal to aw name - expect NOT to find it
64
+ // look for a node pool with a label key equal to aw.Name-aw.Namespace - expect NOT to find it
63
65
test .Eventually (NodePools (test , connection ), TestTimeoutLong ).
64
- ShouldNot (ContainElement (WithTransform (NodePoolLabels , HaveKey (HavePrefix ( "test-instascale" ) ))))
66
+ ShouldNot (ContainElement (WithTransform (NodePoolLabels , HaveKey (expectedLabel ))))
65
67
66
68
}
0 commit comments