summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-09-18 22:25:47 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-09-19 19:44:28 +0200
commit77fdc01b6dfa6f497ed80a46c51e227ca9bdaeed (patch)
tree8a904b4adb11faf92c383ae5576ccd64845f7b90
parented6d95dde5f12727cfa06b851c70b07cb415e9d6 (diff)
Clear network namespaces also after failed test
-rw-r--r--src/Run.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Run.hs b/src/Run.hs
index f7071b9..4a08742 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -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