podman events: check for an error after we finish reading events

The function that's handing us events will return an error after closing
the channel over which it's sending events, and its caller (in its own
goroutine) will then send that error over another channel.

The logic that started the goroutine is likely to notice that the events
channel is closed before noticing that the error channel has a result
for it to read, so any error that would have been communicated would be
lost.

When we finish reading events, check if the reader returned an error
before telling our caller that there was no error.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai
2024-05-13 13:29:09 -04:00
parent ef6619019f
commit c46884aa93
4 changed files with 27 additions and 6 deletions

View File

@@ -406,3 +406,8 @@ EOF
run_podman events --since=1m --stream=false --filter volume=${vname:0:5}
assert "$output" = "$notrunc_results"
}
@test "events - invalid filter" {
run_podman 125 events --since="the dawn of time...ish"
assert "$output" =~ "failed to parse event filters"
}