Skip to content

Commit 9973489

Browse files
committed
test(refactor): Add Toxiproxy Hspec test infrastructure
1 parent 0077aa2 commit 9973489

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
@@ -203,6 +203,21 @@ executable postgrest
203203
else
204204
ghc-options: -O2
205205

206+
library test-utils
207+
visibility: private
208+
default-language: Haskell2010
209+
default-extensions: OverloadedStrings
210+
NoImplicitPrelude
211+
hs-source-dirs: test/lib
212+
exposed-modules: Toxiproxy
213+
build-depends: base >= 4.9 && < 4.22
214+
, aeson >= 2.0.3 && < 2.3
215+
, containers >= 0.5.7 && < 0.8
216+
, http-client >= 0.7.19 && < 0.8
217+
, servant-client >= 0.20.3.0 && < 0.21
218+
, servant >= 0.20.3.0 && < 0.21
219+
, text >= 1.2.2 && < 2.2
220+
206221
test-suite spec
207222
type: exitcode-stdio-1.0
208223
default-language: Haskell2010
@@ -311,6 +326,7 @@ test-suite observability
311326
Observation.JwtCache
312327
Observation.MetricsSpec
313328
Observation.SchemaCacheSpec
329+
Observation.ToxiSpec
314330
build-depends: base >= 4.9 && < 4.22
315331
, base64-bytestring >= 1 && < 1.3
316332
, bytestring >= 0.10.8 && < 0.13
@@ -322,11 +338,15 @@ test-suite observability
322338
, hspec-wai-json >= 0.10 && < 0.12
323339
, http-types >= 0.12.3 && < 0.13
324340
, jose-jwt >= 0.9.6 && < 0.11
341+
, monad-control >= 1.0.1 && < 1.1
325342
, postgrest
326343
, prometheus-client >= 1.1.1 && < 1.2.0
327344
, protolude >= 0.3.1 && < 0.4
328345
, text >= 1.2.2 && < 2.2
346+
, test-utils
347+
, transformers-base >= 0.4.4 && < 0.5
329348
, wai >= 3.2.1 && < 3.3
349+
, wai-extra >= 3.1.8 && < 3.2
330350
ghc-options: -threaded -O0 -Werror -Wall -fwarn-identities
331351
-fno-spec-constr -optP-Wno-nonportable-include-path
332352
-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)