You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Wilfred Spiegelenburg (Jira)" <ji...@apache.org> on 2024/04/26 02:34:00 UTC
[jira] [Created] (YUNIKORN-2590) Handler tests should check for nil request on create
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-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org