Docker.DotNet icon indicating copy to clipboard operation
Docker.DotNet copied to clipboard

fix: Sync Docker system monitor events

Open HofmeisterAn opened this issue 3 years ago • 4 comments

What does this PR do?

Synchronizes the Docker system event tests with the help of AutoResetEvent. At least two tests (MonitorEventsAsync_IsCancelled_NoStreamCorruption and MonitorEventsFiltered_Succeeds) do not synchronize the events. The tests are not deterministic, they might run into a race condition where events are not published on assertions yet.

Why is it important?

Some Docker.DotNet tests are flaky, PR improves the reliability of the tests.

Related issues

  • Relates #599

Follow-ups

  • Looking closer into the tests, I noticed (gut feeling) events triggered, quickly after another might not be published reliable. It looks like they are swallowed.
  • I think we can reduce the complexity of StreamUtil.
  • /cc @dgvives You might want to take a look at the stream corruption test changes.

HofmeisterAn avatar Dec 28 '22 08:12 HofmeisterAn

@HofmeisterAn the stream corruption tests come from #375, I didn't run into this problem myself but I was able to replicate it using that piece of code. I would say tests are good if no stream corruption happens

dgvives avatar Dec 28 '22 13:12 dgvives

@HofmeisterAn the stream corruption tests come from #375, I didn't run into this problem myself but I was able to replicate it using that piece of code. I would say tests are good if no stream corruption happens

I noticed that the events are not published reliable and fixed them too. If you e.g. look at the other PR's build (ff.) you see no event or message output. I got them sometimes on my local runs though.

HofmeisterAn avatar Dec 28 '22 14:12 HofmeisterAn

@galvesribeiro can you please take a look into this PR? I would like to work on some follow-ups.

HofmeisterAn avatar Jan 18 '23 09:01 HofmeisterAn

@galvesribeiro can you please review the PR?

HofmeisterAn avatar Apr 28 '23 08:04 HofmeisterAn