Skip to content

Commit

Permalink
Add more comments after PR #7934.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabedini committed May 9, 2022
1 parent d80e24f commit b8edcfe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,15 @@ withRemoteRepo repoDir m = do
hackageRepoTool "bootstrap" $ ["--keys", keysDir, "--repo", workDir]

-- 4. Wire it up in .cabal/config
-- TODO: libify this
let package_cache = testCabalDir env </> "packages"

-- In the following we launch a python http server to serve the remote
-- repository. When the http server is ready we proceed with the tests.
-- NOTE 1: it's important that both the http server and cabal use the
-- same hostname ("localhost"), otherwise there could be a mismatch
-- (depending on the details of the host networking settings).
-- NOTE 2: here we use a fixed port (8000). This can cause problems in
-- case multiple tests are running concurrently or other another
-- process on the developer machine is using the same port.
liftIO $ do
appendFile (testUserCabalConfigFile env) $
unlines [ "repository repository.localhost"
Expand All @@ -631,7 +637,7 @@ withRemoteRepo repoDir m = do
putStrLn =<< readFile (testUserCabalConfigFile env)

withAsync
(runReaderT (python3 ["-m", "http.server", "-d", workDir, "--bind", "localhost", "8000"]) env)
(flip runReaderT env $ python3 ["-m", "http.server", "-d", workDir, "--bind", "localhost", "8000"])
(\_ -> do
-- wait for the python webserver to come up with a exponential
-- backoff starting from 50ms, up to a maximum wait of 60s
Expand Down

0 comments on commit b8edcfe

Please sign in to comment.