Skip to content

Commit e4d5755

Browse files
committed
0.5.0.0 release
1 parent 488633a commit e4d5755

File tree

9 files changed

+54
-54
lines changed

9 files changed

+54
-54
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Revision history for testcontainer-hs
22

3-
## 0.4.0.0 -- 2023-02-20
3+
## 0.5.0.0 -- 2023-02-20
44

55
* BREAKING: Refined lifecycle management. testcontainers is now using testcontainers/ryuk resource reaper to cleanup containers, networks and volumes. Release keys for containers are deprecated. (@alexbiehl, https://github.com/testcontainers/testcontainers-hs/pull/33)
66

src/TestContainers/Config.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import TestContainers.Monad (Config (..))
1111

1212
-- | Default configuration.
1313
--
14-
-- @since 0.4.0.0
14+
-- @since 0.5.0.0
1515
defaultConfig :: Config
1616
defaultConfig =
1717
Config

src/TestContainers/Docker.hs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ data ContainerRequest = ContainerRequest
280280

281281
-- | Parameters for a naming a Docker container.
282282
--
283-
-- @since 0.4.0.0
283+
-- @since 0.5.0.0
284284
data NamingStrategy
285285
= RandomName
286286
| FixedName Text
@@ -319,7 +319,7 @@ setName = setFixedName
319319
-- | Set the name of a Docker container. This is equivalent to invoking @docker run@
320320
-- with the @--name@ parameter.
321321
--
322-
-- @since 0.4.0.0
322+
-- @since 0.5.0.0
323323
setFixedName :: Text -> ContainerRequest -> ContainerRequest
324324
setFixedName newName req =
325325
-- TODO error on empty Text
@@ -328,7 +328,7 @@ setFixedName newName req =
328328
-- | Set the name randomly given of a Docker container. This is equivalent to omitting
329329
-- the @--name@ parameter calling @docker run@.
330330
--
331-
-- @since 0.4.0.0
331+
-- @since 0.5.0.0
332332
setRandomName :: ContainerRequest -> ContainerRequest
333333
setRandomName req =
334334
-- TODO error on empty Text
@@ -337,7 +337,7 @@ setRandomName req =
337337
-- | Set the name randomly suffixed of a Docker container. This is equivalent to invoking
338338
-- @docker run@ with the @--name@ parameter.
339339
--
340-
-- @since 0.4.0.0
340+
-- @since 0.5.0.0
341341
setSuffixedName :: Text -> ContainerRequest -> ContainerRequest
342342
setSuffixedName preffix req =
343343
-- TODO error on empty Text
@@ -376,22 +376,22 @@ setEnv newEnv req =
376376
-- | Set the network the container will connect to. This is equivalent to passing
377377
-- @--network network_name@ to @docker run@.
378378
--
379-
-- @since 0.4.0.0
379+
-- @since 0.5.0.0
380380
withNetwork :: Network -> ContainerRequest -> ContainerRequest
381381
withNetwork network req =
382382
req {network = Just (Left network)}
383383

384384
-- | Set the network alias for this container. This is equivalent to passing
385385
-- @--network-alias alias@ to @docker run@.
386386
--
387-
-- @since 0.4.0.0
387+
-- @since 0.5.0.0
388388
withNetworkAlias :: Text -> ContainerRequest -> ContainerRequest
389389
withNetworkAlias alias req =
390390
req {networkAlias = Just alias}
391391

392392
-- | Sets labels for a container
393393
--
394-
-- @since 0.4.0.0
394+
-- @since 0.5.0.0
395395
withLabels :: [(Text, Text)] -> ContainerRequest -> ContainerRequest
396396
withLabels xs request =
397397
request {labels = xs}
@@ -406,7 +406,7 @@ setLink newLink req =
406406

407407
-- | Forwards container logs to the given 'LogConsumer' once ran.
408408
--
409-
-- @since 0.4.0.0
409+
-- @since 0.5.0.0
410410
withFollowLogs :: LogConsumer -> ContainerRequest -> ContainerRequest
411411
withFollowLogs logConsumer request =
412412
request {followLogs = Just logConsumer}
@@ -434,14 +434,14 @@ data Port = Port
434434
defaultProtocol :: Text
435435
defaultProtocol = "tcp"
436436

437-
-- @since 0.4.0.0
437+
-- @since 0.5.0.0
438438
instance Show Port where
439439
show Port {port, protocol} =
440440
show port <> "/" <> unpack protocol
441441

442442
-- | A cursed but handy instance supporting literal 'Port's.
443443
--
444-
-- @since 0.4.0.0
444+
-- @since 0.5.0.0
445445
instance Num Port where
446446
fromInteger x =
447447
Port {port = fromIntegral x, protocol = defaultProtocol}
@@ -454,7 +454,7 @@ instance Num Port where
454454
-- | A cursed but handy instance supporting literal 'Port's of them
455455
-- form @"8080"@, @"8080/udp"@, @"8080/tcp"@.
456456
--
457-
-- @since 0.4.0.0
457+
-- @since 0.5.0.0
458458
instance IsString Port where
459459
fromString input = case splitOn "/" (pack input) of
460460
[numberish]
@@ -586,7 +586,7 @@ run request = do
586586

587587
-- | Sets up a Ryuk 'Reaper'.
588588
--
589-
-- @since 0.4.0.0
589+
-- @since 0.5.0.0
590590
createRyukReaper :: TestContainer Reaper
591591
createRyukReaper = do
592592
ryukContainer <-
@@ -768,11 +768,11 @@ data WaitUntilReady
768768
-- Next check
769769
WaitUntilReady
770770

771-
-- | @since 0.4.0.0
771+
-- | @since 0.5.0.0
772772
instance Semigroup WaitUntilReady where
773773
(<>) = WaitMany
774774

775-
-- | @since 0.4.0.0
775+
-- | @since 0.5.0.0
776776
instance Monoid WaitUntilReady where
777777
mempty = WaitReady mempty
778778

@@ -813,7 +813,7 @@ instance Exception InvalidStateException
813813
-- | @waitForState@ waits for a certain state of the container. If the container reaches a terminal
814814
-- state 'InvalidStateException' will be thrown.
815815
--
816-
-- @since 0.4.0.0
816+
-- @since 0.5.0.0
817817
waitForState :: (State -> Bool) -> WaitUntilReady
818818
waitForState isReady = WaitReady $ \Container {id} -> do
819819
let wait = do
@@ -841,7 +841,7 @@ waitForState isReady = WaitReady $ \Container {id} -> do
841841

842842
-- | @successfulExit@ is supposed to be used in conjunction with 'waitForState'.
843843
--
844-
-- @since 0.4.0.0
844+
-- @since 0.5.0.0
845845
successfulExit :: State -> Bool
846846
successfulExit state =
847847
stateStatus state == Exited && stateExitCode state == Just 0
@@ -857,7 +857,7 @@ waitUntilTimeout = WaitUntilTimeout
857857
-- | Waits for a specific http status code.
858858
-- This combinator should always be used with `waitUntilTimeout`.
859859
--
860-
-- @since 0.4.0.0
860+
-- @since 0.5.0.0
861861
waitForHttp ::
862862
-- | Port
863863
Port ->
@@ -1097,7 +1097,7 @@ internalContainerIp Container {id, inspectOutput} =
10971097
-- | Get the container's network alias.
10981098
-- Takes the first alias found.
10991099
--
1100-
-- @since 0.4.0.0
1100+
-- @since 0.5.0.0
11011101
containerAlias :: Container -> Text
11021102
containerAlias Container {id, inspectOutput} =
11031103
case inspectOutput
@@ -1120,7 +1120,7 @@ containerAlias Container {id, inspectOutput} =
11201120
-- | Get the IP address for the container's gateway, i.e. the host.
11211121
-- Takes the first gateway address found.
11221122
--
1123-
-- @since 0.4.0.0
1123+
-- @since 0.5.0.0
11241124
containerGateway :: Container -> Text
11251125
containerGateway Container {id, inspectOutput} =
11261126
case inspectOutput
@@ -1174,7 +1174,7 @@ containerPort Container {id, inspectOutput} Port {port, protocol} =
11741174
-- domain and port if the program is running in the same network. Otherwise,
11751175
-- 'containerAddress' will use the exposed port on the Docker host.
11761176
--
1177-
-- @since 0.4.0.0
1177+
-- @since 0.5.0.0
11781178
containerAddress :: Container -> Port -> (Text, Int)
11791179
containerAddress container Port {port, protocol} =
11801180
let inDocker = unsafePerformIO isRunningInDocker

src/TestContainers/Docker/Internal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import TestContainers.Trace (Trace (..), Tracer, withTrace)
4242

4343
-- | Identifies a network within the Docker runtime. Assigned by @docker network create@
4444
--
45-
-- @since 0.4.0.0
45+
-- @since 0.5.0.0
4646
type NetworkId = Text
4747

4848
-- | Identifies a container within the Docker runtime. Assigned by @docker run@.
@@ -132,12 +132,12 @@ data Pipe
132132

133133
-- | An abstraction for forwarding logs.
134134
--
135-
-- @since 0.4.0.0
135+
-- @since 0.5.0.0
136136
type LogConsumer = Pipe -> ByteString -> IO ()
137137

138138
-- | A simple 'LogConsumer' that writes log lines to stdout and stderr respectively.
139139
--
140-
-- @since 0.4.0.0
140+
-- @since 0.5.0.0
141141
consoleLogConsumer :: LogConsumer
142142
consoleLogConsumer pipe line = do
143143
case pipe of
@@ -150,7 +150,7 @@ consoleLogConsumer pipe line = do
150150

151151
-- | Forwards container logs to a 'LogConsumer'. This is equivalent of calling @docker logs containerId --follow@
152152
--
153-
-- @since 0.4.0.0
153+
-- @since 0.5.0.0
154154
dockerFollowLogs :: (MonadResource m) => Tracer -> ContainerId -> LogConsumer -> m ()
155155
dockerFollowLogs tracer containerId logConsumer = do
156156
let dockerArgs =

src/TestContainers/Docker/Network.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ import Prelude hiding (id)
2929

3030
-- | Handle to a Docker network.
3131
--
32-
-- @since 0.4.0.0
32+
-- @since 0.5.0.0
3333
newtype Network = Network
3434
{ id :: NetworkId
3535
}
3636

3737
-- | Returns the id of the network.
3838
--
39-
-- @since 0.4.0.0
39+
-- @since 0.5.0.0
4040
networkId :: Network -> NetworkId
4141
networkId Network {id} = id
4242

4343
-- | Parameters for creating a new Docker network.
4444
--
45-
-- @since 0.4.0.0
45+
-- @since 0.5.0.0
4646
data NetworkRequest = NetworkRequest
4747
{ ipv6 :: Bool,
4848
driver :: Maybe Text,
@@ -51,7 +51,7 @@ data NetworkRequest = NetworkRequest
5151

5252
-- | Default parameters for creating a new Docker network.
5353
--
54-
-- @since 0.4.0.0
54+
-- @since 0.5.0.0
5555
networkRequest :: NetworkRequest
5656
networkRequest =
5757
NetworkRequest
@@ -62,21 +62,21 @@ networkRequest =
6262

6363
-- | Enable IPv6 for the Docker network.
6464
--
65-
-- @since 0.4.0.0
65+
-- @since 0.5.0.0
6666
withIpv6 :: NetworkRequest -> NetworkRequest
6767
withIpv6 request =
6868
request {ipv6 = True}
6969

7070
-- | Driver to manage the Network (default "bridge").
7171
--
72-
-- @since 0.4.0.0
72+
-- @since 0.5.0.0
7373
withDriver :: Text -> NetworkRequest -> NetworkRequest
7474
withDriver driver request =
7575
request {driver = Just driver}
7676

7777
-- | Creates a new 'Network' from a 'NetworkRequest'.
7878
--
79-
-- @since 0.4.0.0
79+
-- @since 0.5.0.0
8080
createNetwork :: NetworkRequest -> TestContainer Network
8181
createNetwork NetworkRequest {..} = do
8282
Config {..} <- ask

src/TestContainers/Docker/Reaper.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import qualified System.Random as Random
2424

2525
-- | Reaper for safe resource cleanup.
2626
--
27-
-- @since 0.4.0.0
27+
-- @since 0.5.0.0
2828
data Reaper = Reaper
2929
{ -- | @runReaper label value@ reaps Docker any Docker resource with a matching
3030
-- label.
@@ -37,33 +37,33 @@ data Reaper = Reaper
3737
-- | Additional labels to add to any Docker resource on creation. Adding the
3838
-- labels is necessary in order for the 'Reaper' to find resources for cleanup.
3939
--
40-
-- @since 0.4.0.0
40+
-- @since 0.5.0.0
4141
reaperLabels :: Reaper -> [(Text, Text)]
4242
reaperLabels Reaper {labels} =
4343
labels
4444

4545
-- | Ryuk based resource reaper
4646
--
47-
-- @since 0.4.0.0
47+
-- @since 0.5.0.0
4848
newtype Ryuk = Ryuk {ryukSocket :: Socket.Socket}
4949

5050
-- | Tag for the ryuk image
5151
--
52-
-- @since 0.4.0.0
52+
-- @since 0.5.0.0
5353
ryukImageTag :: Text
5454
ryukImageTag =
5555
"docker.io/testcontainers/ryuk:0.3.4"
5656

5757
-- | Exposed port for the ryuk reaper.
5858
--
59-
-- @since 0.4.0.0
59+
-- @since 0.5.0.0
6060
ryukPort :: (Num a) => a
6161
ryukPort =
6262
8080
6363

6464
-- | Creates a new 'Reaper' from a host and port.
6565
--
66-
-- @since 0.4.0.0
66+
-- @since 0.5.0.0
6767
newRyukReaper ::
6868
(MonadResource m) =>
6969
-- | Host

0 commit comments

Comments
 (0)