testcontainers / testcontainers/testcontainers-hs
Expose WaitUntilReady constructors
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 78
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
I'd like to add a custom check, a real connection to the database with a test query. Something like this:
mariaDBReady :: TestDBInfo -> WaitUntilReady
mariaDBReady db = WaitReady $ \container -> do
withFrozenCallStack $ do
let (endpointHost, endpointPort) = containerAddress container db.dbPort
ci =
defaultConnectInfo
{ connectHost = unpack endpointHost
, connectPort = fromIntegral endpointPort
, connectUser = unpack db.dbUsername
, connectPassword = unpack db.dbPassword
, connectDatabase = unpack db.dbName
}
wait = do
r <- try (connect ci >>= flip query_ "select 2 + 3")
case r of
Right [Only (i :: Int)] -> do
pure ()
Left (ex :: IOException) -> do
threadDelay 500000
wait
liftIO wait
This is currently not possible since WaitReady is not public.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the WaitReady constructor and the module export list that currently keeps it private. Check how existing readiness checks are represented, then expose the constructor so callers can define custom database checks like the example. Confirm that the public API still builds and that a custom WaitUntilReady value can be constructed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100