You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Hsien-Cheng(Ryan) Huang (Jira)" <ji...@apache.org> on 2024/04/28 13:24:00 UTC

[jira] [Assigned] (YUNIKORN-2590) Handler tests should check for nil request on create

     [ https://issues.apache.org/jira/browse/YUNIKORN-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hsien-Cheng(Ryan) Huang reassigned YUNIKORN-2590:
-------------------------------------------------

    Assignee: Hsien-Cheng(Ryan) Huang

> 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
>            Assignee: Hsien-Cheng(Ryan) Huang
>            Priority: Major
>              Labels: newbie
>
> 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: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org