Skip to content

Add CEL tests for snippetsFilter API #3750

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
merged 3 commits into from
Aug 20, 2025
Merged

Conversation

salonichf5
Copy link
Contributor

Proposed changes

Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:

Problem: As code owners we want to verify is API validation is working as expected for SnippetsFilter

Solution: Added CEL tests for SnippetsFilter

Testing: Describe any testing that you did.

Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.

Closes #3671

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

NONE

@salonichf5 salonichf5 requested a review from a team as a code owner August 15, 2025 17:49
@github-actions github-actions bot added the tests Pull requests that update tests label Aug 15, 2025
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.88%. Comparing base (22f6954) to head (5ef8cb4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3750   +/-   ##
=======================================
  Coverage   86.88%   86.88%           
=======================================
  Files         128      128           
  Lines       16201    16201           
  Branches       62       62           
=======================================
  Hits        14076    14076           
+ Misses       1952     1951    -1     
- Partials      173      174    +1     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@shaun-nx shaun-nx left a comment

Choose a reason for hiding this comment

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

@salonichf5 these are really great tests that you have added, however we want to keep these tests focused on results from the x-kubernetes-validations errors

For the SnippetsFilter CR, the error we want to test against is this one:

x-kubernetes-validations:
- message: Only one snippet allowed per context
  rule: self.all(s1, self.exists_one(s2, s1.context == s2.context))

@github-project-automation github-project-automation bot moved this from 🆕 New to 🏗 In Progress in NGINX Gateway Fabric Aug 18, 2025
@shaun-nx
Copy link
Contributor

Lets keep the test file name and the function names consistent.

For the file name, it should be tests/cel/SnippetsFilter_test.go and for the function names, we can remove any underscores and keep them camelcase.

@salonichf5
Copy link
Contributor Author

Lets keep the test file name and the function names consistent.

For the file name, it should be tests/cel/SnippetsFilter_test.go and for the function names, we can remove any underscores and keep them camelcase.

I have named it as per the other files

Screenshot 2025-08-19 at 9 26 42 AM

@salonichf5 salonichf5 force-pushed the tests/cel-snippetsFilter branch from d7fd391 to c0da0aa Compare August 19, 2025 17:42
Copy link
Contributor

@bjee19 bjee19 left a comment

Choose a reason for hiding this comment

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

nice!

@shaun-nx
Copy link
Contributor

Lets keep the test file name and the function names consistent.
For the file name, it should be tests/cel/SnippetsFilter_test.go and for the function names, we can remove any underscores and keep them camelcase.

I have named it as per the other files

Screenshot 2025-08-19 at 9 26 42 AM

Sorry I should have been more clear.
The file name currently has a capital F in the word Filter. That should lowercase.
So instead of snippetsFilter_test.go it should be snippetsfilter_test.go

I realize in my first comment I said to change it to SnippetsFilter_test.go but I was wrong there. Sorry about that.

@salonichf5 salonichf5 force-pushed the tests/cel-snippetsFilter branch from d94867b to 5ef8cb4 Compare August 20, 2025 16:32
@salonichf5 salonichf5 enabled auto-merge (squash) August 20, 2025 17:05
@salonichf5 salonichf5 merged commit 782fbff into main Aug 20, 2025
62 of 66 checks passed
@salonichf5 salonichf5 deleted the tests/cel-snippetsFilter branch August 20, 2025 17:17
@github-project-automation github-project-automation bot moved this from 🏗 In Progress to ✅ Done in NGINX Gateway Fabric Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Pull requests that update tests
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add CEL tests for SnippetsFilter CRD
4 participants