-
Notifications
You must be signed in to change notification settings - Fork 100
Add unreferenced file integration tests #1399
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1399 +/- ##
==========================================
- Coverage 86.28% 86.03% -0.26%
==========================================
Files 102 102
Lines 12572 12797 +225
==========================================
+ Hits 10848 11010 +162
- Misses 1248 1302 +54
- Partials 476 485 +9 see 20 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
test/integration/managementplane/config_apply_unreferenced_files_test.go
Show resolved
Hide resolved
| s.Equal(0, code) | ||
|
|
||
| code, _, err := utils.Container.Exec(s.ctx, []string{ | ||
| "test", "-f", "/etc/nginx/test/unreferenced_file.conf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this command doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this command to check file existence. The command would return an exit code which would be 0 if the file exists or 1 if the file doesn't exist and I used this code for the assertions
| responses := utils.ManagementPlaneResponses(s.T(), 2, utils.MockManagementPlaneAPIAddress) | ||
| s.T().Logf("Config apply responses: %v", responses) | ||
|
|
||
| manifestFiles := map[string]*model.ManifestFile{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering for the manfest file map if we could make a helper that returns the map ?
| ) | ||
| s.Require().NoError(err) | ||
|
|
||
| body := `{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this a const and reuse it in each of the tests
Proposed changes
Add unreferenced file support to the mock management plane and add integration tests for it.
When sending a config apply request through the mock, the mock looks at the request body to identify unreferenced files. Here is a sample request body of a config apply that contains an unreferenced file:
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTINGdocumentmake install-toolsand have attached any dependency changes to this pull requestREADME.md)