Skip to content

Commit d4dee04

Browse files
committed
retry ghcide tests on SQLError
1 parent ed4c568 commit d4dee04

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ghcide/ghcide.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ test-suite ghcide-tests
359359
safe-exceptions,
360360
shake,
361361
hls-graph,
362+
sqlite-simple,
362363
tasty,
363364
tasty-expected-failure,
364365
tasty-hunit,

ghcide/test/exe/Main.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import Ide.Types
101101
import Data.String (IsString(fromString))
102102
import qualified Language.LSP.Types as LSP
103103
import Data.IORef.Extra (atomicModifyIORef_)
104+
import Database.SQLite.Simple (SQLError(SQLError))
104105
import Development.IDE.Core.Rules (mainRule)
105106
import qualified Development.IDE.Plugin.HLS.GhcIde as Ghcide
106107
import qualified Development.IDE.Plugin.Test as Test
@@ -5378,7 +5379,11 @@ testIde rootDir arguments session = do
53785379
{ optShakeOptions = (optShakeOptions ideOptions) {shakeThreads = 2}}
53795380
}
53805381

5381-
res <- runSessionWithHandles hInWrite hOutRead config lspTestCaps rootDir session
5382+
let runIt = runSessionWithHandles hInWrite hOutRead config lspTestCaps rootDir session
5383+
-- catch SQL errors and retry once to handle the hiedb getting locked by a previous test
5384+
res <- runIt `catch` \SQLError{} -> do
5385+
sleep 1
5386+
runIt
53825387

53835388
hClose hInWrite
53845389
timeout 3 (wait server) >>= \case

0 commit comments

Comments
 (0)