Skip to content

Commit

Permalink
CA-394882: avoid error on tasks that are not ours
Browse files Browse the repository at this point in the history
The previous unit test step has created some tasks, and deleted them when completed.
However it didn't look at events.
The next step was waiting for some newly created tasks to complete and looking at events.
But it was processing all events, even those that it wasn't watching for.
These events may have referred to tasks that were already deleted.

Fix the code to only query the state of the tasks that we are waiting for
(if these go missing, it is a bug).

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
  • Loading branch information
edwintorok committed Jun 26, 2024
1 parent 2f2d16f commit e4a7d09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ocaml/xenopsd/test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ let wait_for_tasks id =
List.iter
(function
| Dynamic.Task id' ->
if task_ended dbg id' then ids := StringSet.remove id' !ids
(* ignore events on tasks that are not ours, they may have been deleted *)
if StringSet.mem id' !ids && task_ended dbg id' then ids := StringSet.remove id' !ids
| _ ->
()
)
Expand Down

0 comments on commit e4a7d09

Please sign in to comment.