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 signer receiving a drained body on retries #620

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

aouji
Copy link
Contributor

@aouji aouji commented Sep 21, 2024

Description

When retrying, the body can be drained, and there is already code that resets the request body on retries. The issue was that we were sending the drained request to the signer before reseting the request body, so signature would be based on an empty body

Issues Resolved

#202

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Sep 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.99%. Comparing base (06a6dc8) to head (62ff49c).
Report is 70 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #620       +/-   ##
===========================================
+ Coverage   57.29%   67.99%   +10.70%     
===========================================
  Files         315      376       +61     
  Lines        9823     8862      -961     
===========================================
+ Hits         5628     6026      +398     
+ Misses       2902     1555     -1347     
+ Partials     1293     1281       -12     
Flag Coverage Δ
integration 60.35% <0.00%> (+9.51%) ⬆️
unit 15.37% <100.00%> (+2.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
opensearchtransport/opensearchtransport.go 87.16% <100.00%> (+2.00%) ⬆️

... and 273 files with indirect coverage changes

@aouji aouji force-pushed the bugfix/signing-on-retry branch from e485819 to f6a14dd Compare September 21, 2024 23:56
@aouji
Copy link
Contributor Author

aouji commented Sep 22, 2024

I'm not sure why integration tests are failing. Doesn't seem related to my change.

BTW sorry for the mess I seem to have created in this PR. I can't re-trigger DCO and code coverage checks. Please trigger on your side or let me know if I need to close this and open a new PR

@dblock
Copy link
Member

dblock commented Sep 23, 2024

Thank you for fixing this! Let's deal with the integ test separately.

--- FAIL: TestNodes (1.48s)
    --- FAIL: TestNodes/Stats (0.06s)
        --- FAIL: TestNodes/Stats/without_request (0.05s)

You will need to fix DCO, git commit --amend -s and force push your branch please?

@aouji aouji force-pushed the bugfix/signing-on-retry branch from f6a14dd to cff1b90 Compare September 23, 2024 15:33
@aouji
Copy link
Contributor Author

aouji commented Sep 23, 2024

DCO is now fixed

@dblock
Copy link
Member

dblock commented Sep 24, 2024

Any ideas why the integ test started failing?

=== RUN   TestNodes/Stats/without_request
    api_nodes_test.go:182: 
        	Error Trace:	/home/runner/work/opensearch-go/opensearch-go/internal/test/helper.go:147
        	            				/home/runner/work/opensearch-go/opensearch-go/opensearchapi/api_nodes_test.go:182
        	Error:      	Should be empty, but was [{"op":"remove","path":"/nodes/tFKzdl01Ss2oOLoYJtcXcg/indices/search/request/took"}]
        	Test:       	TestNodes/Stats/without_request

@Jakob3xD
Copy link
Collaborator

Any ideas why the integ test started failing?

=== RUN   TestNodes/Stats/without_request
    api_nodes_test.go:182: 
        	Error Trace:	/home/runner/work/opensearch-go/opensearch-go/internal/test/helper.go:147
        	            				/home/runner/work/opensearch-go/opensearch-go/opensearchapi/api_nodes_test.go:182
        	Error:      	Should be empty, but was [{"op":"remove","path":"/nodes/tFKzdl01Ss2oOLoYJtcXcg/indices/search/request/took"}]
        	Test:       	TestNodes/Stats/without_request

The Integration tests runs against latest which was updated 7 days ago to 2.17. I assume the version adds the new field which is currently not present in our spec. We need to add it. Also fails in the dependency updates.

@dblock
Copy link
Member

dblock commented Sep 24, 2024

@Jakob3xD thanks for taking care of the integ tests in #623

@aouji rebase?

@aouji aouji force-pushed the bugfix/signing-on-retry branch from cff1b90 to 62ff49c Compare September 24, 2024 16:22
@dblock dblock merged commit 3f1ca5e into opensearch-project:main Sep 24, 2024
56 checks passed
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.

3 participants