Skip to content
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

🌱 fix TestClusterExtensionInstallReResolvesWhenNewCataloge2e test #1008

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

Conversation

yashoza19
Copy link
Contributor

@yashoza19 yashoza19 commented Jul 2, 2024

Description

  • Created a new Catalog v2 with Prometheus bundle 2.0.0
  • Changes made to build-push-e2e-catalog.sh to allow building and pushing new catalog image
  • Changes made to TestClusterExtensionInstallReResolvesWhenNewCatalog e2e test -
  1. Install ClusterExtension with existing Catalog(v1) which has Prometheus v1.2.0
  2. Once Prometheus v1.2.0 is installed, patch the ExtensionCatalog with the newly created catalog v2
  3. Wait and confirm that ClusterExtension picks the prometheus v2.2.0 from test-catalog:v2 and resolves to a successful install

fixes #945

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@yashoza19 yashoza19 requested a review from a team as a code owner July 2, 2024 15:52
Copy link

netlify bot commented Jul 2, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit e0c069f
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/6685c4d071342c00081c3f33
😎 Deploy Preview https://deploy-preview-1008--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 site configuration.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.19%. Comparing base (f681af0) to head (e0c069f).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1008   +/-   ##
=======================================
  Coverage   77.19%   77.19%           
=======================================
  Files          17       17           
  Lines        1206     1206           
=======================================
  Hits          931      931           
  Misses        193      193           
  Partials       82       82           
Flag Coverage Δ
e2e 56.62% <ø> (+0.08%) ⬆️
unit 51.90% <ø> (ø)

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.

@yashoza19 yashoza19 force-pushed the issue945 branch 2 times, most recently from 09ff7f3 to 4065eb1 Compare July 2, 2024 22:45
echo "Illegal number of arguments passed"
echo "${help}"
exit 1
fi

namespace=$1
tag=$2
image=$2
tag=$3
Copy link
Member

@joelanford joelanford Jul 3, 2024

Choose a reason for hiding this comment

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

Instead of passing an extra tag argument, can we parse the image argument to extract the tag? That would decrease chance of mistakes and copy/pasta errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call. I will update it.

Comment on lines +63 to +81
func patchTestCatalog(ctx context.Context, name string, newImageRef string) (*catalogd.ClusterCatalog, error) {
// Fetch the existing ClusterCatalog
catalog := &catalogd.ClusterCatalog{}
err := c.Get(ctx, client.ObjectKey{Name: name}, catalog)
if err != nil {
return nil, err
}

// Update the ImageRef
catalog.Spec.Source.Image.Ref = newImageRef

// Patch the ClusterCatalog
err = c.Update(ctx, catalog)
if err != nil {
return nil, err
}

return catalog, err
}
Copy link
Member

@joelanford joelanford Jul 3, 2024

Choose a reason for hiding this comment

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

I think this is a valid test case (where we patch the spec of a ClusterCatalog), but it does not cover the case I had in mind (and a case I think we need to cover).

What I have in mind here specifically is that we need to prove that the polling behavior alone is enough to trigger an upgrade of a ClusterExtension. Forcing a change by changing the image in the ClusterCatalog spec is a side-effect foils the true intention of the test.

This "polling triggers an upgrade" test is one of the most important features of OLM, so we unfortunately can't "fake" it by touching the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my first approach as well. Unfortunately, I can't find a way to change the latest image tag on a local registry. crane does not allow to change tags on local registries, hence I took this approach. Let me know if you you think this is still a valid test or we can approach this issue with a different solution. @joelanford

Copy link
Contributor

Choose a reason for hiding this comment

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

This "polling triggers an upgrade" test is one of the most important features of OLM, so we unfortunately can't "fake" it my touching the spec.

How is this accomplished in the current version of OLM? The use of make/sh/kinako(spelling), to get things into the cluster, the go to run tests, IMO blurs what is/isn't being tested, there aren't clear separation of duties in this model.

Correct me if I'm wrong, but I think you want an image loaded into the running cluster after the test has executed? Is that correct? Or do you just want this test to run longer to see if the polling picks up the the image already in the registry?

Copy link
Member

Choose a reason for hiding this comment

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

How is this accomplished in the current version of OLM?

I'm not sure

The use of make/sh/kinako(spelling), to get things into the cluster, the go to run tests, IMO blurs what is/isn't being tested, there aren't clear separation of duties in this model.

I agree that the number of moving parts is a problem. I'm fairly confident that if we wanted something a bit leaner, we could build all of this in Go.

  1. Code in go that runs during an e2e that deploys an image registry in the cluster.
  2. Client-go code that runs kubectl port-forward to give the e2e test a way to communicate with the registry.
  3. go-containerregistry code to push images, move tags, etc.

Correct me if I'm wrong, but I think you want an image loaded into the running cluster after the test has executed? Is that correct?

No, I don't think that is sufficient because the polling behavior of catalogd queries a remote registry. kind load would not make it visible to the polling process. What I'm after is $something that causes the digest of a tag to change mid way through the test. That could be one of:

  1. Pre-populating the registry with two catalog images as part of the setup, and then during the test re-tagging the second image over the first.
  2. Pushing the first image at repo:tag as part of the setup, and then pushing the second image at that same repo:tag during the test.

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.

Fix: e2e test for re-reconcile on catalog change is not valid
3 participants