Skip to content

Commit 1a54036

Browse files
committed
feat: fix e2e
Signed-off-by: Ramesh Krishna <[email protected]>
1 parent 8a5a6bf commit 1a54036

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

test/e2e/clusteradm/init_test.go

+35-34
Original file line numberDiff line numberDiff line change
@@ -34,47 +34,48 @@ var _ = ginkgo.Describe("test clusteradm with bootstrap token in singleton mode"
3434
gomega.Expect(err).NotTo(gomega.HaveOccurred())
3535
gomega.Expect(len(cm.Spec.RegistrationConfiguration.FeatureGates)).Should(gomega.Equal(1))
3636

37-
// TODO: E2e test is not recognizing the newly added flags. Uncomment below test once the problem is fixed.
38-
//err = e2e.Clusteradm().Init(
39-
// "--use-bootstrap-token",
40-
// "--context", e2e.Cluster().Hub().Context(),
41-
// "--bundle-version=latest",
42-
// "--registration-auth awsirsa",
43-
// "--hub-cluster-arn arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
44-
//)
45-
//gomega.Expect(err).NotTo(gomega.HaveOccurred(), "clusteradm init error")
46-
//
47-
//cm, err = operatorClient.OperatorV1().ClusterManagers().Get(context.TODO(), "cluster-manager", metav1.GetOptions{})
48-
//gomega.Expect(err).NotTo(gomega.HaveOccurred())
49-
//// Ensure that when only awsirsa is passed as registration-auth only awsirsa driver is available
50-
//gomega.Expect(len(cm.Spec.RegistrationConfiguration.RegistrationDrivers)).Should(gomega.Equal(1))
51-
//gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[0].AuthType).Should(gomega.Equal("awsirsa"))
52-
//
53-
//err = e2e.Clusteradm().Init(
54-
// "--use-bootstrap-token",
55-
// "--context", e2e.Cluster().Hub().Context(),
56-
// "--bundle-version=latest",
57-
// "--registration-auth awsirsa",
58-
// "--registration-auth csr",
59-
// "--hub-cluster-arn arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
60-
//)
61-
//gomega.Expect(err).NotTo(gomega.HaveOccurred(), "clusteradm init error")
62-
//
63-
//cm, err = operatorClient.OperatorV1().ClusterManagers().Get(context.TODO(), "cluster-manager", metav1.GetOptions{})
64-
//gomega.Expect(err).NotTo(gomega.HaveOccurred())
65-
//// Ensure that awsirsa and csr is passed as registration-auth both the values are set.
66-
//gomega.Expect(len(cm.Spec.RegistrationConfiguration.RegistrationDrivers)).Should(gomega.Equal(2))
67-
//gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[0].AuthType).Should(gomega.Equal("csr"))
68-
//gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[1].AuthType).Should(gomega.Equal("awsirsa"))
69-
//gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[1].HubClusterArn).
70-
// Should(gomega.Equal("arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1"))
37+
err = e2e.Clusteradm().Init(
38+
"--use-bootstrap-token",
39+
"--context", e2e.Cluster().Hub().Context(),
40+
"--bundle-version=latest",
41+
"--registration-auth=awsirsa",
42+
"--hub-cluster-arn=arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
43+
)
44+
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "clusteradm init error")
45+
46+
cm, err = operatorClient.OperatorV1().ClusterManagers().Get(context.TODO(), "cluster-manager", metav1.GetOptions{})
47+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
48+
// Ensure that when only awsirsa is passed as registration-auth only awsirsa driver is available
49+
gomega.Expect(len(cm.Spec.RegistrationConfiguration.RegistrationDrivers)).Should(gomega.Equal(1))
50+
gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[0].AuthType).Should(gomega.Equal("awsirsa"))
7151

7252
err = e2e.Clusteradm().Init(
7353
"--use-bootstrap-token",
7454
"--context", e2e.Cluster().Hub().Context(),
7555
"--bundle-version=latest",
7656
"--registration-auth=awsirsa",
7757
"--registration-auth=csr",
58+
"--hub-cluster-arn=arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
59+
)
60+
gomega.Expect(err).NotTo(gomega.HaveOccurred(), "clusteradm init error")
61+
62+
cm, err = operatorClient.OperatorV1().ClusterManagers().Get(context.TODO(), "cluster-manager", metav1.GetOptions{})
63+
gomega.Expect(err).NotTo(gomega.HaveOccurred())
64+
// Ensure that awsirsa and csr is passed as registration-auth both the values are set.
65+
gomega.Expect(len(cm.Spec.RegistrationConfiguration.RegistrationDrivers)).Should(gomega.Equal(2))
66+
gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[0].AuthType).Should(gomega.Equal("csr"))
67+
gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[1].AuthType).Should(gomega.Equal("awsirsa"))
68+
gomega.Expect(cm.Spec.RegistrationConfiguration.RegistrationDrivers[1].HubClusterArn).
69+
Should(gomega.Equal("arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1"))
70+
71+
err = e2e.Clusteradm().Init(
72+
"--use-bootstrap-token",
73+
"--context", e2e.Cluster().Hub().Context(),
74+
"--bundle-version=latest",
75+
"--registration-auth=awsirsa",
76+
"--registration-auth=csr",
77+
"--hub-cluster-arn=arn:aws:eks:us-west-2:123456789012:cluster/hub-cluster1",
78+
"--feature-gates=ManagedClusterAutoApproval=true",
7879
"--auto-approved-csr-identities=csr1",
7980
"--auto-approved-arn-patterns=arn:aws:eks:us-west-2:123456789012:cluster/*",
8081
)

0 commit comments

Comments
 (0)