Skip to content

Fix Nplus directives definition #105

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 1 commit into from
Jul 11, 2024
Merged

Fix Nplus directives definition #105

merged 1 commit into from
Jul 11, 2024

Conversation

dengsh12
Copy link
Contributor

Proposed changes

In #100 we provided support files for ParseOptions.DirectiveSources. For some reason analyze_nplus_latest_directives.go was override to a legacy version with mismatch from NGX_CONF_TAKE4 to ngxConfTake2. This PR is to fix those directives(keyval and limit_req_zone). Thanks to @oliveromahony found this problem.

Checklist

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

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • I have updated any relevant documentation (README.md)

@dengsh12 dengsh12 requested a review from a team as a code owner July 10, 2024 16:45
Copy link
Member

@ornj ornj left a comment

Choose a reason for hiding this comment

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

Approved, but let's think about how we might be able to test this kind of scenario to see if there are any more errors (and prevent them in the future).

@dengsh12
Copy link
Contributor Author

Approved, but let's think about how we might be able to test this kind of scenario to see if there are any more errors (and prevent them in the future).

Sure! I think such problems boil down to some small errors in generator leading to error in only one or two directives. Current UT unlikely to discover such problems. I'm thinking of adding a huge "standard map" which includes most of directives to test the latest OSS/Nplus matchFunc(kind of like what I was doing in POC).

@ornj
Copy link
Member

ornj commented Jul 10, 2024

@dengsh12 tests that will cover the generator tool will be useful when that lands. Maybe that's enough if there's enough coverage of the bitmasks.

@ryepup
Copy link
Contributor

ryepup commented Jul 10, 2024

Approved, but let's think about how we might be able to test this kind of scenario to see if there are any more errors (and prevent them in the future).

Sure! I think such problems boil down to some small errors in generator leading to error in only one or two directives. Current UT unlikely to discover such problems. I'm thinking of adding a huge "standard map" which includes most of directives to test the latest OSS/Nplus matchFunc(kind of like what I was doing in POC).

yet another case where a corpus of anonymized NGINX configs would be real handy

@dengsh12
Copy link
Contributor Author

update: added ut from @oliveromahony's PR #104

@dengsh12 dengsh12 merged commit 7ccbf75 into nginxinc:main Jul 11, 2024
2 checks passed
ryepup added a commit to ryepup/nginx-go-crossplane that referenced this pull request Jul 12, 2024
We fixed a bug in nginxinc#105 and added a test, but the test didn't cover the original bug of analysis errors using the default `DirectiveSources` nor the differences between N+ and OSS.
@ryepup ryepup mentioned this pull request Jul 12, 2024
4 tasks
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.

4 participants