[#420] Ensure `NettestEnv` is not evaluated before the tests are run
Description
Problem: we found some very specific scenarios where using unsafePerformIO
to create a NettestEnv
in Morley.Nettest.Tasty
can lead to crashes in the CI.
See issue for details: #420 (closed)
The conclusion was that we should somehow ensure that IO NettestEnv
is not run while the TestTree
is being built/traversed, but only when the tests have started running.
Solution: The idea is to force the user to evaluate IO NettestEnv
inside the test case, instead of evaluating it ourselves in Morley.Nettest.Tasty
.
This MR also fixes a couple other small problems:
- Replaced
withNettestEnv
withwhenNetworkEnabled
to reduce some duplication - Ensure tests that use
whenNetworkEnabled
don't run at the same time as tests that usenettestScenario
/nettestScenarioCaps
. - In !613 (merged), I accidentally introduced a bug and now only 20 out of the 233 contracts are being tested. This MR fixes that.
Related issue(s)
Resolves #420 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.
Edited by Diogo Castro