Fix flaky integration test for auto approval awsirsa (#1178)
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Failing after 40s
Post / coverage (push) Failing after 33s
Post / images (amd64, addon-manager) (push) Failing after 36s
Post / images (amd64, placement) (push) Failing after 36s
Post / images (amd64, registration) (push) Failing after 34s
Post / images (amd64, registration-operator) (push) Failing after 36s
Post / images (amd64, work) (push) Failing after 40s
Post / images (arm64, addon-manager) (push) Failing after 32s
Post / images (arm64, placement) (push) Failing after 38s
Post / images (arm64, registration) (push) Failing after 30s
Post / images (arm64, registration-operator) (push) Failing after 39s
Post / images (arm64, work) (push) Failing after 36s
Post / image manifest (addon-manager) (push) Has been skipped
Post / image manifest (placement) (push) Has been skipped
Post / image manifest (registration) (push) Has been skipped
Post / image manifest (registration-operator) (push) Has been skipped
Post / image manifest (work) (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped

Signed-off-by: Jeffrey Wong <jeffreywong0417@gmail.com>
This commit is contained in:
Jeffrey
2025-09-10 23:26:53 -04:00
committed by GitHub
parent b506d16cf8
commit cb8854b08b

View File

@@ -187,7 +187,7 @@ var _ = ginkgo.Describe("Joining Process for aws flow", ginkgo.Ordered, func() {
})
ginkgo.It("managedcluster should join successfully with auto approval of manged cluster in patterns for aws flow", func() {
ginkgo.It("managedcluster should join successfully with auto approval of managed cluster in patterns for aws flow", func() {
managedClusterArn := "arn:aws:eks:us-west-2:123456789012:cluster/managed-cluster1"
managedClusterRoleSuffix := "7f8141296c75f2871e3d030f85c35692"
@@ -220,11 +220,17 @@ var _ = ginkgo.Describe("Joining Process for aws flow", ginkgo.Ordered, func() {
if err != nil {
return false
}
return cluster.Spec.HubAcceptsClient
// Check for the presence of expected AWS IRSA annotations
_, hasArn := cluster.Annotations[operatorv1.ClusterAnnotationsKeyPrefix+"/"+awsirsa.ManagedClusterArn]
_, hasRole := cluster.Annotations[operatorv1.ClusterAnnotationsKeyPrefix+"/"+awsirsa.ManagedClusterIAMRoleSuffix]
if hasArn && hasRole {
return cluster.Spec.HubAcceptsClient
}
return false
}, eventuallyTimeout, eventuallyInterval).Should(gomega.BeTrue())
})
ginkgo.It("managedcluster should join successfully with auto approval rejected of manged cluster not in patterns for aws flow", func() {
ginkgo.It("managedcluster should not join successfully with auto approval rejected of managed cluster not in patterns for aws flow", func() {
managedClusterArn := "arn:aws:eks:us-west-1:123456789012:cluster/managed-cluster2"
managedClusterRoleSuffix := "7f8141296c75f2871e3d030f85c35692"
@@ -257,12 +263,24 @@ var _ = ginkgo.Describe("Joining Process for aws flow", ginkgo.Ordered, func() {
return err
}, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred())
// Wait for the managed cluster to have AWS IRSA annotations populated
gomega.Eventually(func() bool {
cluster, err := util.GetManagedCluster(clusterClient, managedClusterName)
if err != nil {
return false
}
// Check for the presence of expected AWS IRSA annotations
_, hasArn := cluster.Annotations[operatorv1.ClusterAnnotationsKeyPrefix+"/"+awsirsa.ManagedClusterArn]
_, hasRole := cluster.Annotations[operatorv1.ClusterAnnotationsKeyPrefix+"/"+awsirsa.ManagedClusterIAMRoleSuffix]
return hasArn && hasRole
}, eventuallyTimeout, eventuallyInterval).Should(gomega.BeTrue(), "ManagedCluster should have AWS IRSA annotations")
// The ManagedCluster CR should never be accepted
gomega.Consistently(func() bool {
cluster, err := util.GetManagedCluster(clusterClient, managedClusterName)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
return cluster.Spec.HubAcceptsClient
}, eventuallyTimeout, eventuallyInterval).Should(gomega.BeFalse())
}, eventuallyTimeout, eventuallyInterval).Should(gomega.BeFalse(), "HubAcceptsClient should never become true for ARN not matching auto-approval pattern")
})
}