ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
427 stars 110 forks source link

tests(dot/sync/worker): enhance the unit test #4032

Closed EmilGeorgiev closed 1 week ago

EmilGeorgiev commented 3 weeks ago

Issue summary

The worker type in the 'dot/sync' package is tested 100% which is great. In many small projects I see files to be tested 100%.

Event that all line code is tested we still can enhance the test:

  1. We can initialise the channel 'guardChannel' with size 1, run two workers and check that they never work concurrently
  2. Assert that what we put in the queue is used later in the request.
  3. Check that what is returned from the request is passed to the result channel