diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-09-18 22:25:47 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-09-19 19:44:28 +0200 |
commit | 77fdc01b6dfa6f497ed80a46c51e227ca9bdaeed (patch) | |
tree | 8a904b4adb11faf92c383ae5576ccd64845f7b90 | |
parent | ed6d95dde5f12727cfa06b851c70b07cb415e9d6 (diff) |
Clear network namespaces also after failed test
-rw-r--r-- | src/Run.hs | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -233,11 +233,10 @@ withInternet :: (Network -> TestRun a) -> TestRun a withInternet inner = do testDir <- asks $ optTestDir . teOptions . fst inet <- newInternet testDir - res <- withNetwork (inetRoot inet) $ \net -> do - withTypedVar rootNetworkVar net $ do - inner net - delInternet inet - return res + flip finally (delInternet inet) $ do + withNetwork (inetRoot inet) $ \net -> do + withTypedVar rootNetworkVar net $ do + inner net withSubnet :: Network -> Maybe (TypedVarName Network) -> (Network -> TestRun a) -> TestRun a withSubnet parent tvname inner = do |