pkg: authorization: cleanup tests#22588
Conversation
- do use use log pkg - do not t.Fatal in goroutine - cleanups Signed-off-by: Antonio Murdaca <runcom@redhat.com>
| t.recordedRequest = Request{} | ||
| defer r.Body.Close() | ||
| body, err := ioutil.ReadAll(r.Body) | ||
| body, _ := ioutil.ReadAll(r.Body) |
There was a problem hiding this comment.
why ignoring errors ? (here and below ?)
There was a problem hiding this comment.
As it was done somewhere else in this test. These specific removals were because you can't log or Fatal here in a goroutine
There was a problem hiding this comment.
True but you could return a error (in the response) and thus make the test fail if an error occured (and was not wanted) 👼
There was a problem hiding this comment.
the body is checked in the tests above using reflect.DeepEqual so I think it's safe to ignore the error but just print the body to the response (it will fail the reflect check eventually)
| r.HandleFunc("/Plugin.Activate", t.activate) | ||
| r.HandleFunc("/"+AuthZApiRequest, t.auth) | ||
| r.HandleFunc("/"+AuthZApiResponse, t.auth) | ||
| t.listener, _ = net.Listen("tcp", pluginAddress) |
There was a problem hiding this comment.
I don't have any idea why this line was here though.....
|
@vdemeester is it ok for you? |
|
yep 😉 |
|
LGTM |
|
LGTM 🐯 |
logpkgt.Fatalin goroutineSigned-off-by: Antonio Murdaca runcom@redhat.com