Skip to content

Commit d85339b

Browse files
address feedback
1 parent e253d9b commit d85339b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

test/e2e/instascale_nodepool_test.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package e2e
22

33
import (
4+
"fmt"
45
"testing"
56

67
. "github.com/onsi/gomega"
@@ -34,14 +35,15 @@ func TestInstascaleNodepool(t *testing.T) {
3435
connection := CreateOCMConnection(test)
3536
defer connection.Close()
3637

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-
4238
// Setup batch job and AppWrapper
4339
aw := instaScaleJobAppWrapper(test, namespace, cm)
4440

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+
4547
// apply AppWrapper to cluster
4648
_, err := test.Client().MCAD().WorkloadV1beta1().AppWrappers(namespace.Name).Create(test.Ctx(), aw, metav1.CreateOptions{})
4749
test.Expect(err).NotTo(HaveOccurred())
@@ -51,16 +53,16 @@ func TestInstascaleNodepool(t *testing.T) {
5153
test.Eventually(AppWrapper(test, namespace, aw.Name), TestTimeoutGpuProvisioning).
5254
Should(WithTransform(AppWrapperState, Equal(mcadv1beta1.AppWrapperStateActive)))
5355

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
5557
test.Eventually(NodePools(test, connection), TestTimeoutLong).
56-
Should(ContainElement(WithTransform(NodePoolLabels, HaveKey(HavePrefix("test-instascale")))))
58+
Should(ContainElement(WithTransform(NodePoolLabels, HaveKey(expectedLabel))))
5759

5860
// assert that the AppWrapper goes to "Completed" state
5961
test.Eventually(AppWrapper(test, namespace, aw.Name), TestTimeoutLong).
6062
Should(WithTransform(AppWrapperState, Equal(mcadv1beta1.AppWrapperStateCompleted)))
6163

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
6365
test.Eventually(NodePools(test, connection), TestTimeoutLong).
64-
ShouldNot(ContainElement(WithTransform(NodePoolLabels, HaveKey(HavePrefix("test-instascale")))))
66+
ShouldNot(ContainElement(WithTransform(NodePoolLabels, HaveKey(expectedLabel))))
6567

6668
}

0 commit comments

Comments
 (0)