From 77fdc01b6dfa6f497ed80a46c51e227ca9bdaeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 18 Sep 2025 22:25:47 +0200 Subject: Clear network namespaces also after failed test --- src/Run.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Run.hs') 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 -- cgit v1.2.3