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 helm chart e2e tests: MatchYAML to Equal #692

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

rgeraskin
Copy link
Contributor

What this PR does

In this PR, I’ve reverted MatchYAML to Equal, fixed all the broken tests. Also, I discovered and fixed a bug in the core provider specification condition.

Why we need it:

While working on PR #688, I’ve observed that a significant number of Helm chart e2e tests are false positives. This is because the generated YAML files in the test/e2e/resources directory do not accurately reflect the expected results from the test cases.

I believe this issue arises because MatchYAML is being used instead of Equal (#549). MatchYAML only compares the first YAML document within a file, as demonstrated in a quick example.

package main_test

import (
	"testing"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
)

func TestGomega(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Gomega Suite")
}

var _ = Describe("MatchYAML compares only the first document", func() {
	It("equals", func() {
		yaml1 := `---
hello: world
---
actually: do not care about this document
`
		yaml2 := `---
hello: world
---
even if it is not a valid yaml
`
		Expect(yaml1).To(MatchYAML(yaml2))
	})
})

- Modify helm test cases to use `.To(Equal())` instead of `.To(MatchYAML())`
- Add new test resource for manager-defined scenario with no feature gates
- Update some test resources with version bumps and minor spec modifications
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 28, 2025
@k8s-ci-robot k8s-ci-robot requested review from damdo and Fedosin January 28, 2025 01:02
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 28, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @rgeraskin. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 28, 2025
Copy link

netlify bot commented Jan 28, 2025

Deploy Preview for kubernetes-sigs-cluster-api-operator ready!

Name Link
🔨 Latest commit 1914631
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-operator/deploys/67982cb798478d000812e337
😎 Deploy Preview https://deploy-preview-692--kubernetes-sigs-cluster-api-operator.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.

@furkatgofurov7
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 28, 2025
@Danil-Grigorev
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 28, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 1899a0c3b5d3fff8743bc39489ed1cd27f835b2a

@furkatgofurov7
Copy link
Member

Thank you!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: furkatgofurov7

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 28, 2025
@rgeraskin
Copy link
Contributor Author

Thanks for the fast review 🙂

@k8s-ci-robot k8s-ci-robot merged commit 911b5c5 into kubernetes-sigs:main Jan 28, 2025
14 checks passed
@rgeraskin rgeraskin deleted the fix-helm-chart-e2e-tests branch January 28, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants