From cc8b8cd10d1ecc43cc3ee99222c427bb1bede92d Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:25:58 +0000 Subject: [PATCH] agent: fix hanging test (#907) --- tests/XFTPServerTests.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/XFTPServerTests.hs b/tests/XFTPServerTests.hs index 1a8024278..5ad3e4364 100644 --- a/tests/XFTPServerTests.hs +++ b/tests/XFTPServerTests.hs @@ -245,6 +245,8 @@ testFileLog = do rIdVar1 <- newTVarIO "" rIdVar2 <- newTVarIO "" + threadDelay 100000 + withXFTPServerStoreLogOn $ \_ -> testXFTPClient $ \c -> runRight_ $ do let file = FileInfo {sndKey, size = chSize, digest} chunkSpec = XFTPChunkSpec {filePath = testChunkPath, chunkOffset = 0, chunkSize = chSize} @@ -260,6 +262,8 @@ testFileLog = do logSize testXFTPLogFile `shouldReturn` 3 logSize testXFTPStatsBackupFile `shouldReturn` 11 + threadDelay 100000 + withXFTPServerThreadOn $ \_ -> testXFTPClient $ \c -> runRight_ $ do sId <- liftIO $ readTVarIO sIdVar rId1 <- liftIO $ readTVarIO rIdVar1 @@ -272,6 +276,8 @@ testFileLog = do deleteXFTPChunk c spKey sId `catchError` (liftIO . (`shouldBe` PCEProtocolError AUTH)) + threadDelay 100000 + withXFTPServerStoreLogOn $ \_ -> testXFTPClient $ \c -> runRight_ $ do rId1 <- liftIO $ readTVarIO rIdVar1 rId2 <- liftIO $ readTVarIO rIdVar2 @@ -283,9 +289,13 @@ testFileLog = do logSize testXFTPLogFile `shouldReturn` 4 logSize testXFTPStatsBackupFile `shouldReturn` 11 + threadDelay 100000 + withXFTPServerStoreLogOn $ \_ -> pure () -- ack is compacted - -1 from log logSize testXFTPLogFile `shouldReturn` 3 + threadDelay 100000 + withXFTPServerStoreLogOn $ \_ -> testXFTPClient $ \c -> runRight_ $ do sId <- liftIO $ readTVarIO sIdVar rId1 <- liftIO $ readTVarIO rIdVar1 @@ -300,10 +310,14 @@ testFileLog = do logSize testXFTPLogFile `shouldReturn` 4 logSize testXFTPStatsBackupFile `shouldReturn` 11 + threadDelay 100000 + withXFTPServerStoreLogOn $ \_ -> pure () -- compacts on start logSize testXFTPLogFile `shouldReturn` 0 logSize testXFTPStatsBackupFile `shouldReturn` 11 + threadDelay 100000 + removeFile testXFTPLogFile removeFile testXFTPStatsBackupFile where