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

Add tests for additional SSL directives and key algorithms. #276 #469

Merged
merged 8 commits into from
Sep 21, 2023

Conversation

arsenalzp
Copy link
Contributor

Proposed changes

Fix #276

Add tests for additional SSL directives and public key algorithms.

Checklist

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

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • 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
  • [] If applicable, I have updated any relevant documentation (README.md)
  • [] If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

…ginx#276)

Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
@netlify
Copy link

netlify bot commented Sep 9, 2023

Deploy Preview for agent-public-docs canceled.

Name Link
🔨 Latest commit 81a4699
🔍 Latest deploy log https://app.netlify.com/sites/agent-public-docs/deploys/6509d16eb6bd980008449041

@github-actions github-actions bot added the chore Pull requests for routine tasks label Sep 9, 2023
@oliveromahony
Copy link
Contributor

Thanks for contributing, if you run make deps it should update all the appropriate files for you

@arsenalzp
Copy link
Contributor Author

Thanks for contributing, if you run make deps it should update all the appropriate files for you

Hello,
it is failing with the following errors:

go: finding module for package github.com/nginx/agent/sdk/v2/proto
go: finding module for package github.com/nginx/agent/sdk/v2/proto/events
go: finding module for package github.com/nginx/agent/sdk/v2/proto/common
go: github.com/nginx/agent/v2/src/core imports
        github.com/nginx/agent/sdk/v2/proto: module github.com/nginx/agent/sdk/v2@latest found (v2.29.0, replaced by ./sdk), but does not contain package github.com/nginx/agent/sdk/v2/proto
go: github.com/nginx/agent/v2/src/extensions imports
        github.com/nginx/agent/sdk/v2/proto/events: module github.com/nginx/agent/sdk/v2@latest found (v2.29.0, replaced by ./sdk), but does not contain package github.com/nginx/agent/sdk/v2/proto/events
go: github.com/nginx/agent/v2 imports
        github.com/nginx/agent/sdk/v2/agent/events imports
        github.com/nginx/agent/sdk/v2/proto/common: module github.com/nginx/agent/sdk/v2@latest found (v2.29.0, replaced by ./sdk), but does not contain package github.com/nginx/agent/sdk/v2/proto/common
make: *** [Makefile:103: deps] Error 1

go version is 1.21.1

@aphralG
Copy link
Contributor

aphralG commented Sep 14, 2023

Thanks for contributing, if you run make deps it should update all the appropriate files for you

Hello, it is failing with the following errors:

go: finding module for package github.com/nginx/agent/sdk/v2/proto
go: finding module for package github.com/nginx/agent/sdk/v2/proto/events
go: finding module for package github.com/nginx/agent/sdk/v2/proto/common
go: github.com/nginx/agent/v2/src/core imports
        github.com/nginx/agent/sdk/v2/proto: module github.com/nginx/agent/sdk/v2@latest found (v2.29.0, replaced by ./sdk), but does not contain package github.com/nginx/agent/sdk/v2/proto
go: github.com/nginx/agent/v2/src/extensions imports
        github.com/nginx/agent/sdk/v2/proto/events: module github.com/nginx/agent/sdk/v2@latest found (v2.29.0, replaced by ./sdk), but does not contain package github.com/nginx/agent/sdk/v2/proto/events
go: github.com/nginx/agent/v2 imports
        github.com/nginx/agent/sdk/v2/agent/events imports
        github.com/nginx/agent/sdk/v2/proto/common: module github.com/nginx/agent/sdk/v2@latest found (v2.29.0, replaced by ./sdk), but does not contain package github.com/nginx/agent/sdk/v2/proto/common
make: *** [Makefile:103: deps] Error 1

go version is 1.21.1

Hi,
Could you try running go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.1 then try run make deps again. Thank you

@arsenalzp
Copy link
Contributor Author

Hi, Could you try running go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.1 then try run make deps again. Thank you

go install successfully finished:

$ go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.1
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/Masterminds/sprig v2.15.0+incompatible
go: downloading google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4
go: downloading github.com/envoyproxy/protoc-gen-validate v0.3.0-java
go: downloading github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007
go: downloading google.golang.org/protobuf v1.27.1
go: downloading github.com/gogo/protobuf v1.1.1
go: downloading github.com/google/uuid v1.1.2
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/huandu/xstrings v1.0.0
go: downloading github.com/imdario/mergo v0.3.4
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading github.com/aokoli/goutils v1.0.1
$

However, make deps fell down into the same errors...

@aphralG
Copy link
Contributor

aphralG commented Sep 14, 2023

Hi, Could you try running go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.1 then try run make deps again. Thank you

go install successfully finished:

$ go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.1
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/Masterminds/sprig v2.15.0+incompatible
go: downloading google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4
go: downloading github.com/envoyproxy/protoc-gen-validate v0.3.0-java
go: downloading github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007
go: downloading google.golang.org/protobuf v1.27.1
go: downloading github.com/gogo/protobuf v1.1.1
go: downloading github.com/google/uuid v1.1.2
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/huandu/xstrings v1.0.0
go: downloading github.com/imdario/mergo v0.3.4
go: downloading golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: downloading github.com/aokoli/goutils v1.0.1
$

However, make deps fell down into the same errors...

We think there is an issue with go version 1.21.1, we are looking into it at the moment. Until we resolve the issue, you can make your changes and make sure the unit tests pass, then we can run make deps on the branch for you. Thank you

@arsenalzp
Copy link
Contributor Author

arsenalzp commented Sep 14, 2023

I found the issue and fixed it.

  1. go compiler was yielding about missing package proto
  2. it was missed due to protobuf file compilation error
  3. protobuf compilation fell down into errors due to missed protoc-gen-doc and protoc-gen-gogo binaries
  4. $GOBIN was set to $GOPATH/bin
  5. protoc-gen-doc and protoc-gen-gogo were installed bu running go install

@arsenalzp
Copy link
Contributor Author

Clause ssl_certificate_key was removed from the code as was mentioned earlier.
Could you please review code again?

Copy link
Contributor

@Dean-Coakley Dean-Coakley left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks very much for your work @arsenalzp !

Copy link
Contributor

@Dean-Coakley Dean-Coakley left a comment

Choose a reason for hiding this comment

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

Actually vendor dirs need updating and these are some unit test failures that need to be resolved.

Then it should be good to go.

@arsenalzp
Copy link
Contributor Author

I'm trying to investigate root cause why unit test fails; I tried to run make unit-test locally, no fails, unit-test of sdk module, single test of TestGetNginxConfig and TestSslDirectives passes successfully.

Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
@arsenalzp
Copy link
Contributor Author

arsenalzp commented Sep 15, 2023

Actually vendor dirs need updating and these are some unit test failures that need to be resolved.

Then it should be good to go.

Necessary changes were made.

Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
@arsenalzp
Copy link
Contributor Author

I've just found that some test files use scripts/tls/gen_cert.sh without algorithm name parameter, it leads to certificate generation failure. Necessary changes were made to gen_cert.sh file.
Could you please be so kind to review changes again?

@arsenalzp
Copy link
Contributor Author

arsenalzp commented Sep 15, 2023

It is obviously that the issue is located in generateCertificates() function during gen_cert.sh script running: exit status 2 means there's a permissions problem or a missing keyword in a command or script.
Unit tests pass locally.
Colleagues, I need your help with debugging, because I'm unable to trigger unit test run in CI.

scripts/tls/gen_cert.sh Outdated Show resolved Hide resolved
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
scripts/tls/gen_cert.sh Outdated Show resolved Hide resolved
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Patch coverage has no change and project coverage change: -0.14% ⚠️

Comparison is base (556f51e) 66.44% compared to head (81a4699) 66.31%.
Report is 1 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
- Coverage   66.44%   66.31%   -0.14%     
==========================================
  Files         118      118              
  Lines       13390    13390              
==========================================
- Hits         8897     8879      -18     
- Misses       3903     3921      +18     
  Partials      590      590              

see 5 files with indirect coverage changes

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

@arsenalzp
Copy link
Contributor Author

All unit and integration tests were passed! Thank all of you for your assistance!

@dhurley dhurley merged commit d1f6013 into nginx:main Sep 21, 2023
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase coverage in NGINX config unit tests
6 participants