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

[YUNIKORN-2590] Handler tests should check for nil request on create #865

Closed
wants to merge 1 commit into from

Conversation

ryankert01
Copy link
Contributor

@ryankert01 ryankert01 commented May 10, 2024

What is this PR for?

In the handler_test.go file we have an anti pattern showing a large number (40+) warnings in an IDE:

'req' might have 'nil' or other unexpected value as its corresponding error variable might be not 'nil'

The warning are due to the fact that we have the following pattern:

req, err = http.NewRequest("GET", "path", strings.NewReader(""))
req = req.WithContext(context.WithValue(req.Context(), httprouter.ParamsKey, httprouter.Params{}))

There is no error assertion after the request creation. We should add a simple assert.NilError(t, err, "HTTP request create failed") inserted between creating and using the request.

What type of PR is it?

  • - Bug Fix
  • - Improvement
  • - Feature
  • - Documentation
  • - Hot Fix
  • - Refactoring

Todos

n/a

What is the Jira issue?

https://issues.apache.org/jira/browse/YUNIKORN-2590

How should this be tested?

Github CI

Screenshots (if appropriate)

Questions:

  • - The licenses files need update.
  • - There is breaking changes for older versions.
  • - It needs documentation.

Copy link

codecov bot commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.07%. Comparing base (aab9eb7) to head (59c62e5).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #865      +/-   ##
==========================================
- Coverage   77.08%   77.07%   -0.02%     
==========================================
  Files          97       97              
  Lines       11989    11989              
==========================================
- Hits         9242     9240       -2     
- Misses       2415     2416       +1     
- Partials      332      333       +1     

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

Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

LGTM

@chia7712 chia7712 closed this in 677bf90 May 11, 2024
@ryankert01 ryankert01 deleted the YUNIKORN-2590 branch October 13, 2024 12:35
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.

2 participants