tmp-proc-example 0.6.0.0 → 0.7.0.0
raw patch · 4 files changed
+16/−20 lines, 4 filesdep −http-client-tlsdep ~tmp-proc
Dependencies removed: http-client-tls
Dependency ranges changed: tmp-proc
Files
- ChangeLog.md +4/−0
- specs/TmpProc/Example1/IntegrationTaste.hs +3/−4
- specs/TmpProc/Example2/IntegrationSpec.hs +6/−7
- tmp-proc-example.cabal +3/−9
ChangeLog.md view
@@ -2,6 +2,10 @@ `tmp-proc-example` uses [PVP Versioning][1]. +## 0.7.0.0 -- 2024-05-12++* Extend the upper bound for tmp-proc to allow 0.7+ ## 0.6.0.0 -- 2024-01-09 * Extend the upper bound for tmp-proc to 0.6
specs/TmpProc/Example1/IntegrationTaste.hs view
@@ -18,8 +18,7 @@ import Data.Maybe (isJust) import Data.Proxy (Proxy (..)) import Database.Redis (parseConnectInfo)-import Network.HTTP.Client (newManager)-import Network.HTTP.Client.TLS (tlsManagerSettings)+import Network.HTTP.Client (defaultManagerSettings, newManager) import Servant.Client ( BaseUrl (..) , ClientEnv@@ -157,9 +156,9 @@ Right x -> pure x -clientEnvOf :: AreProcs procs => ServerHandle procs -> IO ClientEnv+clientEnvOf :: (AreProcs procs) => ServerHandle procs -> IO ClientEnv clientEnvOf s = do- mgr <- newManager tlsManagerSettings+ mgr <- newManager defaultManagerSettings pure $ mkClientEnv mgr $ BaseUrl Http "localhost" (serverPort s) ""
specs/TmpProc/Example2/IntegrationSpec.hs view
@@ -17,8 +17,7 @@ import Data.Either (isLeft) import Data.Maybe (isJust) import Data.Proxy (Proxy (..))-import Network.HTTP.Client (newManager)-import Network.HTTP.Client.TLS (tlsManagerSettings)+import Network.HTTP.Client (defaultManagerSettings, newManager) import Servant.Client ( BaseUrl (..) , ClientEnv@@ -106,7 +105,7 @@ Note the use of the 'HasHandle' constraint to indicate what TmpProcs the function uses. -}-hasInCache :: HasHandle TmpRedis procs => ServerHandle procs -> ContactID -> IO Bool+hasInCache :: (HasHandle TmpRedis procs) => ServerHandle procs -> ContactID -> IO Bool hasInCache sh cid = withConnOf @TmpRedis Proxy (handles sh) $ \cache -> fmap isJust $ Cache.loadContact cache cid @@ -115,7 +114,7 @@ Here, ServerHandle specifies the full list of types required by the calling test code. -}-hasInDb :: ServerHandle ('[TmpPostgres, TmpRedis]) -> ContactID -> IO Bool+hasInDb :: ServerHandle '[TmpPostgres, TmpRedis] -> ContactID -> IO Bool hasInDb sh cid = do let dbUriOf = hUri . handleOf @"a-postgres-db" Proxy . handles fmap isJust $ flip DB.fetch cid $ dbUriOf sh@@ -128,7 +127,7 @@ - use the servant client to invoke the backend - check the state of service backends via the @ProcHandles@ in the 'ServerHandle'. -}-type Fixture = (ServerHandle ('[TmpPostgres, TmpRedis]), ClientEnv)+type Fixture = (ServerHandle '[TmpPostgres, TmpRedis], ClientEnv) mkFixture :: IO Fixture@@ -157,9 +156,9 @@ shutdown' (sh, _) = shutdown sh -clientEnvOf :: AreProcs procs => ServerHandle procs -> IO ClientEnv+clientEnvOf :: (AreProcs procs) => ServerHandle procs -> IO ClientEnv clientEnvOf s = do- mgr <- newManager tlsManagerSettings+ mgr <- newManager defaultManagerSettings pure $ mkClientEnv mgr $ BaseUrl Http "localhost" (serverPort s) ""
tmp-proc-example.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: tmp-proc-example-version: 0.6.0.0+version: 0.7.0.0 synopsis: Test a simple service with backends running on docker using tmp-proc description: An example of testing a service that uses Postgresql and Redis where these@@ -16,12 +16,7 @@ build-type: Simple extra-source-files: ChangeLog.md-tested-with:- GHC == 8.8.4- GHC == 8.10.7- GHC == 9.0.2- GHC == 9.2.8- GHC == 9.4.5+tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.5 source-repository head type: git@@ -55,7 +50,6 @@ , hspec , hspec-tmp-proc , http-client- , http-client-tls , monad-logger , mtl , persistent@@ -69,7 +63,7 @@ , tasty-hunit , text , time- , tmp-proc >=0.5.3 && <0.7+ , tmp-proc >=0.5.3 && <0.8 , tmp-proc-postgres , tmp-proc-redis , transformers