-
Notifications
You must be signed in to change notification settings - Fork 749
Remove Integration Monad #6346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Integration Monad #6346
Conversation
b99bb37 to
0bf6d79
Compare
0f61855 to
d7b60ca
Compare
|
|
||
| liftIOAnnotated :: (HasCallStack, MonadIO m) => IO a -> m a | ||
| liftIOAnnotated action = GHC.withFrozenCallStack $ | ||
| liftIO $ action `catch` (\(e :: SomeException) -> throwM $ exceptionWithCallStack e) No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is catch from Prelude right? So this should work with watchdog exceptions I think. Could you add a comment here that we're catching async exceptions here as well intentionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of copying code downstream. Have you given a thought how we could reconcile your changes with hedgehog-extras, so possibly we could avoid the duplication?
My main issue with that is having to fix issues in both places, because we're using similar code in cardano-cli as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll open a PR.
| -- The port number if it is obtained using 'H.randomPort', it is firstly bound to and then closed. The closing | ||
| -- and release in the operating system is done asynchronously and can be slow. Here we wait until the port | ||
| -- is out of CLOSING state. | ||
| H.note_ $ "Waiting for port " <> show port <> " to be available before starting node" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a useful trace. I don't remember if we weren't experiencing hangups long time ago at this place. In general it would be nice to have a tracer available here so we could emit traces about the progress of the node startup.
cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/SanityCheck.hs
Show resolved
Hide resolved
| (_,asyncA) <- asyncRegister_ (threadDelay 10_000_000) | ||
| let tId = asyncThreadId asyncA | ||
| return (s,tId) | ||
| afterForkedThread <- getCurrentTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI You can use https://hackage-content.haskell.org/package/hedgehog-extras-0.10.1.0/docs/Hedgehog-Extras-Test-TestWatchdog.html to verify if code paths were reached.
createEnvOptions This removes the unnecessary Integration monad
Add Testnet.Process.RunIO which exposes execCli functions without the MonadTest constraint
This differs from hedgehog-extras's asyncRegister function in that the thread is linked before it is cancelled.
fe34af3 to
824036b
Compare
824036b to
8ad1337
Compare
palas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It looks good and I don't see any issues in the logic. I've written some style suggestions. And I think the changed files could use a formatter, because I've seen several spaces at the end of line, maybe stylish-haskell would be enough
Description
Remove
Integrationmonad from functions that we also want to use outside of property tests.Introduce annotated exceptions (via
liftIOAnnotated) where theIntegrationmonad has been removed in order to preserve debugging information.Checklist
See Runnings tests for more details
CHANGELOG.mdfor affected package.cabalfiles are updatedhlint. See.github/workflows/check-hlint.ymlto get thehlintversionstylish-haskell. See.github/workflows/stylish-haskell.ymlto get thestylish-haskellversionghc-9.6andghc-9.12Note on CI
If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.