Skip to content

🌱 test: replace ArgoCD manifest regression test with mock-based resource validation #2103

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Jul 16, 2025

Description

This PR replaces the old render regression test that used ArgoCD YAML files and make verify to check for changes. Instead, we now use a much simpler and clearer mock-based test. Context: #1897

Why we changed it:

  • The old test was hard to understand — it wasn’t clear what we were really testing.
  • If make verify failed, people could just run it again and accidentally accept changes without noticing regressions.
  • It used ArgoCD YAMLs, but it wasn’t obvious why — were they for e2e tests, or just testdata? It was confusing.
  • We were generating YAML files that weren’t used anywhere else.

What’s better now:

  • Instead of real ArgoCD YAMLs, we use fake (mocked) Kubernetes resources like Deployment, Service, Role, NetworkPolicy, etc.
  • We test more types of resources, and check each one fully (kind, namespace, name, and content).
  • This makes the test easier to follow and more reliable.

It’s clearer, easier to maintain, and checks what we care about. 🌱

@camilamacedo86 camilamacedo86 requested a review from a team as a code owner July 16, 2025 02:10
@openshift-ci openshift-ci bot requested review from bentito and oceanc80 July 16, 2025 02:11
Copy link

openshift-ci bot commented Jul 16, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign camilamacedo86 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

netlify bot commented Jul 16, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 0abdf8f
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6877a55b592dea00088d4e18
😎 Deploy Preview https://deploy-preview-2103--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

codecov bot commented Jul 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.43%. Comparing base (36809b3) to head (0abdf8f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2103      +/-   ##
==========================================
- Coverage   73.48%   73.43%   -0.05%     
==========================================
  Files          78       78              
  Lines        7240     7240              
==========================================
- Hits         5320     5317       -3     
- Misses       1568     1570       +2     
- Partials      352      353       +1     
Flag Coverage Δ
e2e 43.80% <ø> (-0.10%) ⬇️
experimental-e2e 50.05% <ø> (+0.13%) ⬆️
unit 58.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@camilamacedo86 camilamacedo86 force-pushed the remove-bundles-argo branch 7 times, most recently from 311dab9 to 36ae501 Compare July 16, 2025 07:17
@camilamacedo86 camilamacedo86 force-pushed the remove-bundles-argo branch 2 times, most recently from 49b8051 to f7a2e82 Compare July 16, 2025 12:53
@camilamacedo86 camilamacedo86 changed the title (NOT MERGE) - Test 🌱 test: replace ArgoCD manifest regression test with mock-based resource validation Jul 16, 2025
// - All expected resources are returned.
// - The full content of each resource matches the expected values
// It validates that the rendered objects are correctly rendered.
func Test_Render_ValidatesOutputForAllInstallModes(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@perdasilva I could improve this one.
I hope that you liked it

@anik120 and @thetechnick were involved in the introduction of this one, so I think it's good to ping them to help us PTAL this one and get it merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you've raised some valid concerns in the description, but missed the main point of this test. What we want to verify is that the registry+v1 bundle renderer consistently behaves in the expected way. That is, given the same bundle (+ config) the renderer always outputs the same manifests.

The way we decided to do this is by taking an existing bundle that we are confident is correct (since we use the ArgoCD operator in our config sample - we took that one) and using the registry+v1 bundle renderer to generate manifests with different configurations (right now watchNamespace, but will also be subscriptionConfig in the near future) and make sure that the output doesn't change (i.e. the renderer's behavior has not changed).

The way I'm reading the test here is we create our own renderer which returns the mocked resources and we verify that implementation. Does that make sense?

I'm also not a huge fan of carrying so many manifests and I hear your concerns about the whats and whys. Maybe we could find a different way to address those concerns? Maybe adding a README, etc.?

What we want to be certain of is that we consistently render registry+v1 bundles in the same way. The most important part of that is whether the ClusterServiceVersion gets transpiled in to the right Deployment, RBAC, Webhook resources. Other resource kinds will just get tacked on. So, things like NetworkPolicy are not so important - or are as important as any other (service, configmap, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants