Skip to content

Commit 64671fc

Browse files
committed
test(refactor): Add Toxiproxy Hspec test infrastructure
1 parent 2783535 commit 64671fc

7 files changed

Lines changed: 469 additions & 16 deletions

File tree

nix/tools/tests.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ let
4242
}
4343
''
4444
${withTools.withPg} -f test/observability/fixtures/load.sql \
45-
${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:observability -- "''${_arg_leftovers[@]}"
45+
${withTools.withToxiproxyPg} \
46+
${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:observability -- "''${_arg_leftovers[@]}"
4647
'';
4748

4849
testDoctests =

postgrest.cabal

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ executable postgrest
204204
else
205205
ghc-options: -O2
206206

207+
library test-utils
208+
visibility: private
209+
default-language: Haskell2010
210+
default-extensions: OverloadedStrings
211+
NoImplicitPrelude
212+
hs-source-dirs: test/lib
213+
exposed-modules: Toxiproxy
214+
build-depends: base >= 4.9 && < 4.22
215+
, aeson >= 2.0.3 && < 2.3
216+
, containers >= 0.5.7 && < 0.8
217+
, http-client >= 0.7.19 && < 0.8
218+
, servant-client >= 0.20.3.0 && < 0.21
219+
, servant >= 0.20.3.0 && < 0.21
220+
, text >= 1.2.2 && < 2.2
221+
207222
test-suite spec
208223
type: exitcode-stdio-1.0
209224
default-language: Haskell2010
@@ -312,6 +327,7 @@ test-suite observability
312327
Observation.JwtCache
313328
Observation.MetricsSpec
314329
Observation.SchemaCacheSpec
330+
Observation.ToxiSpec
315331
build-depends: base >= 4.9 && < 4.22
316332
, base64-bytestring >= 1 && < 1.3
317333
, bytestring >= 0.10.8 && < 0.13
@@ -323,11 +339,15 @@ test-suite observability
323339
, hspec-wai-json >= 0.10 && < 0.12
324340
, http-types >= 0.12.3 && < 0.13
325341
, jose-jwt >= 0.9.6 && < 0.11
342+
, monad-control >= 1.0.1 && < 1.1
326343
, postgrest
327344
, prometheus-client >= 1.1.1 && < 1.2.0
328345
, protolude >= 0.3.1 && < 0.4
329346
, text >= 1.2.2 && < 2.2
347+
, test-utils
348+
, transformers-base >= 0.4.4 && < 0.5
330349
, wai >= 3.2.1 && < 3.3
350+
, wai-extra >= 3.1.8 && < 3.2
331351
ghc-options: -threaded -O0 -Werror -Wall -fwarn-identities
332352
-fno-spec-constr -optP-Wno-nonportable-include-path
333353
-fwrite-ide-info

src/PostgREST/AppState.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module PostgREST.AppState
77
( AppState
88
, destroy
9+
, flushPool
910
, getConfig
1011
, getSchemaCache
1112
, getMainThreadId

0 commit comments

Comments
 (0)