-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore(tests): Align 1-120_repo_server_system_ca_trust.go with downstream #2158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jannfis
merged 1 commit into
argoproj-labs:master
from
olivergondza:fix-systemcatrust-tests
Apr 16, 2026
+20
−25
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,11 +55,6 @@ import ( | |
| ) | ||
|
|
||
| var ( | ||
| // The differences between the upstream image using Ubuntu, and the downstream one using rhel. | ||
| image = "" // argocd-operator default | ||
| imageVersion = "" // argocd-operator default | ||
| caBundlePath = "/etc/ssl/certs/ca-certificates.crt" | ||
|
|
||
| trustedHelmAppSource = &appv1alpha1.ApplicationSource{ | ||
| RepoURL: "https://stefanprodan.github.io/podinfo", | ||
| Chart: "podinfo", | ||
|
|
@@ -74,14 +69,17 @@ var ( | |
| Helm: &appv1alpha1.ApplicationSourceHelm{Values: "service:\n type: ClusterIP"}, | ||
| } | ||
|
|
||
| k8sClient client.Client | ||
| ctx context.Context | ||
| k8sClient client.Client | ||
| ctx context.Context | ||
| ns *corev1.Namespace | ||
| cleanupNs func() | ||
| image string | ||
| imageVersion string | ||
|
|
||
| clusterSupportsClusterTrustBundles bool | ||
| ) | ||
|
|
||
| var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | ||
|
|
||
| Context("1-120_repo_server_system_ca_trust", func() { | ||
| BeforeEach(func() { | ||
| fixture.EnsureSequentialCleanSlate() | ||
|
|
@@ -93,12 +91,13 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| }) | ||
|
|
||
| AfterEach(func() { | ||
| fixture.OutputDebugOnFail(ns) | ||
| cleanupNs() | ||
| purgeCtbs() | ||
| }) | ||
|
|
||
| It("ensures that missing Secret aborts startup", func() { | ||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| By("creating Argo CD instance with missing Secret") | ||
| argoCD := argoCDSpec(ns, argov1beta1api.ArgoCDRepoSpec{ | ||
|
|
@@ -120,8 +119,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| Skip("Cluster does not support ClusterTrustBundles") | ||
| } | ||
|
|
||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| // Create a bundle with 2 CA certs in it. Ubuntu's update-ca-certificates issues a warning, but apparently it works | ||
| // It is desirable to test with multiple certs in one bundle because OpenShift permits it | ||
|
|
@@ -161,8 +159,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| }) | ||
|
|
||
| It("ensures that CMs and Secrets are trusted in repo-server and plugins", func() { | ||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| cmCert := createCmFromCert(ns, getCACert("github.com")) | ||
| Expect(k8sClient.Create(ctx, cmCert)).To(Succeed()) | ||
|
|
@@ -210,8 +207,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| }) | ||
|
|
||
| It("ensures that 0 trusted certs with DropImageCertificates trusts nothing", func() { | ||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| By("creating Argo CD instance with empty system trust") | ||
| argoCD := argoCDSpec(ns, argov1beta1api.ArgoCDRepoSpec{ | ||
|
|
@@ -243,8 +239,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| }) | ||
|
|
||
| It("ensures that empty trust keeps image certs in place", func() { | ||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| By("creating Argo CD instance with empty system trust") | ||
| argoCD := argoCDSpec(ns, argov1beta1api.ArgoCDRepoSpec{ | ||
|
|
@@ -258,8 +253,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| }) | ||
|
|
||
| It("ensures that Secrets and ConfigMaps get reconciled", func() { | ||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| By("creating Argo CD instance with empty system trust, but full of anticipation") | ||
| argoCD := argoCDSpec(ns, argov1beta1api.ArgoCDRepoSpec{ | ||
|
|
@@ -350,8 +344,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| Skip("Cluster does not support ClusterTrustBundles") | ||
| } | ||
|
|
||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| combinedCtb := createCtbFromCerts(getCACert("github.com"), getCACert("github.io")) | ||
| _ = k8sClient.Delete(ctx, combinedCtb) // Exists only in case of previous failures, must be deleted before argo starts! | ||
|
|
@@ -403,8 +396,7 @@ var _ = Describe("GitOps Operator Sequential E2E Tests", func() { | |
| Skip("Cluster does not support ClusterTrustBundles") | ||
| } | ||
|
|
||
| ns, cleanupFunc := fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
| defer cleanupFunc() | ||
| ns, cleanupNs = fixture.CreateRandomE2ETestNamespaceWithCleanupFunc() | ||
|
|
||
| // Use random label value not to collide with leftover CTBs fom other tests | ||
| labelVal := rand.String(5) | ||
|
|
@@ -794,7 +786,9 @@ func getTrustedCertCount(rsPod *corev1.Pod) int { | |
| command := []string{ | ||
| "kubectl", "-n", rsPod.Namespace, "exec", | ||
| "-c", "argocd-repo-server", rsPod.Name, "--", | ||
| "cat", caBundlePath, | ||
| "bash", "-c", | ||
| // Ubuntu or RHEL location | ||
| "cat /etc/ssl/certs/ca-certificates.crt || cat /etc/ssl/certs/ca-bundle.crt", | ||
|
anandf marked this conversation as resolved.
|
||
| } | ||
|
|
||
| var out string | ||
|
|
@@ -852,6 +846,7 @@ func findRunningRepoServerPod(k8sClient client.Client, ns *corev1.Namespace) *co | |
| pod = runningPods[0] | ||
| return nil | ||
| } | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: This empty line can be removed IMO. |
||
| return fmt.Errorf("expected exactly one running repo-server pod, found %d", len(runningPods)) | ||
| }, "40s", "5s").WithOffset(1).Should(Succeed(), "Failed to find Running repo-server pod") | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep CA bundle path strict to upstream Ubuntu behavior in this test
Using
cat ...ca-certificates.crt || ...ca-bundle.crtmakes the test accept downstream-specific layout and weakens what this upstream test is verifying.Suggested fix
Based on learnings: In the file
tests/ginkgo/sequential/1-120_repo_server_system_ca_trust.go, the CA bundle path should be set to/etc/ssl/certs/ca-certificates.crton Ubuntu, and downstream RHEL/Fedora/UBI-specific logic should not be mixed in this file.📝 Committable suggestion
🤖 Prompt for AI Agents