Wilfred Spiegelenburg created YUNIKORN-2590:
-----------------------------------------------

             Summary: Handler tests should check for nil request on create
                 Key: YUNIKORN-2590
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-2590
             Project: Apache YuniKorn
          Issue Type: Improvement
          Components: core - common, test - unit
            Reporter: Wilfred Spiegelenburg


In the handler_test.go file we have an anti pattern showing a large number 
(40+) warnings in an IDE:
{quote}'req' might have 'nil' or other unexpected value as its corresponding 
error variable might be not 'nil'
{quote}
The warning are due to the fact that we have the following pattern:
{code:java}
req, err = http.NewRequest("GET", "path", strings.NewReader(""))
req = req.WithContext(context.WithValue(req.Context(), httprouter.ParamsKey, 
httprouter.Params{})){code}
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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@yunikorn.apache.org
For additional commands, e-mail: dev-h...@yunikorn.apache.org

Reply via email to