test: Reorganize test/ folder into one subdirectory for each test type

This commit is contained in:
Wolfgang Walther
2022-01-07 13:10:36 +01:00
committed by Wolfgang Walther
parent 8060fe3559
commit 8b63d928ae
110 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ jobs:
- name: Run IO tests - name: Run IO tests
if: always() if: always()
run: postgrest-with-postgresql-${{ matrix.pgVersion }} -f test/io-tests/fixtures.sql postgrest-test-io run: postgrest-with-postgresql-${{ matrix.pgVersion }} -f test/io/fixtures.sql postgrest-test-io
- name: Run query cost tests - name: Run query cost tests
if: always() if: always()
+1 -1
View File
@@ -149,7 +149,7 @@ the PostgREST repo. Paths are resolved relative to the repo root:
$ cd src $ cd src
# Even though the current directory is ./src, the config path must still start # Even though the current directory is ./src, the config path must still start
# from the repo root: # from the repo root:
$ postgrest-run test/io-tests/configs/simple.conf $ postgrest-run test/io/configs/simple.conf
``` ```
## Testing ## Testing
+3 -3
View File
@@ -39,7 +39,7 @@ let
docs = "Run the vegeta loadtests with PostgREST."; docs = "Run the vegeta loadtests with PostgREST.";
args = [ args = [
"ARG_OPTIONAL_SINGLE([output], [o], [Filename to dump json output to], [./loadtest/result.bin])" "ARG_OPTIONAL_SINGLE([output], [o], [Filename to dump json output to], [./loadtest/result.bin])"
"ARG_OPTIONAL_SINGLE([testdir], [t], [Directory to load tests and fixtures from], [./test/loadtest])" "ARG_OPTIONAL_SINGLE([testdir], [t], [Directory to load tests and fixtures from], [./test/load])"
"ARG_LEFTOVERS([additional vegeta arguments])" "ARG_LEFTOVERS([additional vegeta arguments])"
]; ];
inRootDir = true; inRootDir = true;
@@ -97,7 +97,7 @@ let
# Save the results in the current working tree, too, # Save the results in the current working tree, too,
# otherwise they'd be lost in the temporary working tree # otherwise they'd be lost in the temporary working tree
# created by withTools.withGit. # created by withTools.withGit.
${withTools.withGit} "$_arg_target" ${loadtest} --output "$PWD/loadtest/$_arg_target.bin" --testdir "$PWD/test/loadtest" "''${_arg_leftovers[@]}" ${withTools.withGit} "$_arg_target" ${loadtest} --output "$PWD/loadtest/$_arg_target.bin" --testdir "$PWD/test/load" "''${_arg_leftovers[@]}"
cat << EOF cat << EOF
@@ -111,7 +111,7 @@ let
EOF EOF
${loadtest} --output "$PWD/loadtest/head.bin" --testdir "$PWD/test/loadtest" "''${_arg_leftovers[@]}" ${loadtest} --output "$PWD/loadtest/head.bin" --testdir "$PWD/test/load" "''${_arg_leftovers[@]}"
cat << EOF cat << EOF
+1 -1
View File
@@ -17,7 +17,7 @@ let
withPath = [ postgrestProfiled curl ]; withPath = [ postgrestProfiled curl ];
} }
'' ''
${withTools.withPg} test/memory-tests.sh ${withTools.withPg} test/memory/memory-tests.sh
''; '';
in in
+4 -4
View File
@@ -92,8 +92,8 @@ let
} }
'' ''
${cabal-install}/bin/cabal v2-build ${devCabalOptions} ${cabal-install}/bin/cabal v2-build ${devCabalOptions}
${cabal-install}/bin/cabal v2-exec -- ${withTools.withPg} -f test/io-tests/fixtures.sql \ ${cabal-install}/bin/cabal v2-exec -- ${withTools.withPg} -f test/io/fixtures.sql \
${ioTestPython}/bin/pytest -v test/io-tests "''${_arg_leftovers[@]}" ${ioTestPython}/bin/pytest -v test/io "''${_arg_leftovers[@]}"
''; '';
dumpSchema = dumpSchema =
@@ -137,8 +137,8 @@ let
# collect all tests # collect all tests
HPCTIXFILE="$tmpdir"/io.tix \ HPCTIXFILE="$tmpdir"/io.tix \
${withTools.withPg} -f test/io-tests/fixtures.sql ${cabal-install}/bin/cabal v2-exec ${devCabalOptions} -- \ ${withTools.withPg} -f test/io/fixtures.sql ${cabal-install}/bin/cabal v2-exec ${devCabalOptions} -- \
${ioTestPython}/bin/pytest -v test/io-tests ${ioTestPython}/bin/pytest -v test/io
HPCTIXFILE="$tmpdir"/spec.tix \ HPCTIXFILE="$tmpdir"/spec.tix \
${withTools.withPg} ${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:spec ${withTools.withPg} ${cabal-install}/bin/cabal v2-run ${devCabalOptions} test:spec
+1 -1
View File
@@ -19,7 +19,7 @@ let
docs = "Run the given command in a temporary database with ${name}"; docs = "Run the given command in a temporary database with ${name}";
args = args =
[ [
"ARG_OPTIONAL_SINGLE([fixtures], [f], [SQL file to load fixtures from], [test/fixtures/load.sql])" "ARG_OPTIONAL_SINGLE([fixtures], [f], [SQL file to load fixtures from], [test/spec/fixtures/load.sql])"
"ARG_POSITIONAL_SINGLE([command], [Command to run])" "ARG_POSITIONAL_SINGLE([command], [Command to run])"
"ARG_LEFTOVERS([command arguments])" "ARG_LEFTOVERS([command arguments])"
"ARG_USE_ENV([PGUSER], [postgrest_test_authenticator], [Authenticator PG role])" "ARG_USE_ENV([PGUSER], [postgrest_test_authenticator], [Authenticator PG role])"
+3 -3
View File
@@ -160,7 +160,7 @@ test-suite spec
default-extensions: OverloadedStrings default-extensions: OverloadedStrings
QuasiQuotes QuasiQuotes
NoImplicitPrelude NoImplicitPrelude
hs-source-dirs: test hs-source-dirs: test/spec
main-is: Main.hs main-is: Main.hs
other-modules: Feature.AndOrParamsSpec other-modules: Feature.AndOrParamsSpec
Feature.AsymmetricJwtSpec Feature.AsymmetricJwtSpec
@@ -237,7 +237,7 @@ test-suite querycost
default-extensions: OverloadedStrings default-extensions: OverloadedStrings
QuasiQuotes QuasiQuotes
NoImplicitPrelude NoImplicitPrelude
hs-source-dirs: test hs-source-dirs: test/spec
main-is: QueryCost.hs main-is: QueryCost.hs
other-modules: SpecHelper other-modules: SpecHelper
build-depends: base >= 4.9 && < 4.16 build-depends: base >= 4.9 && < 4.16
@@ -271,7 +271,7 @@ test-suite doctests
default-language: Haskell2010 default-language: Haskell2010
default-extensions: OverloadedStrings default-extensions: OverloadedStrings
NoImplicitPrelude NoImplicitPrelude
hs-source-dirs: test/doctests hs-source-dirs: test/doc
main-is: Main.hs main-is: Main.hs
build-depends: base >= 4.9 && < 4.16 build-depends: base >= 4.9 && < 4.16
, doctest >= 0.8 , doctest >= 0.8
@@ -1155,7 +1155,7 @@ spec actualPgVersion =
[str|unnamed text arg|] [str|unnamed text arg|]
it "can insert bytea directly" $ do it "can insert bytea directly" $ do
let file = unsafePerformIO $ BL.readFile "test/C.png" let file = unsafePerformIO $ BL.readFile "test/spec/fixtures/image.png"
r <- request methodPost "/rpc/unnamed_bytea_param" r <- request methodPost "/rpc/unnamed_bytea_param"
[("Content-Type", "application/octet-stream"), ("Accept", "application/octet-stream")] [("Content-Type", "application/octet-stream"), ("Accept", "application/octet-stream")]
file file
@@ -1189,7 +1189,7 @@ spec actualPgVersion =
} }
it "will err when no function with single unnamed bytea parameter exists and application/octet-stream is specified" $ it "will err when no function with single unnamed bytea parameter exists and application/octet-stream is specified" $
let file = unsafePerformIO $ BL.readFile "test/C.png" in let file = unsafePerformIO $ BL.readFile "test/spec/fixtures/image.png" in
request methodPost "/rpc/unnamed_int_param" request methodPost "/rpc/unnamed_int_param"
[("Content-Type", "application/octet-stream")] [("Content-Type", "application/octet-stream")]
file file
@@ -1229,7 +1229,7 @@ spec actualPgVersion =
[str|unnamed text arg|] [str|unnamed text arg|]
`shouldRespondWith` `shouldRespondWith`
[str|unnamed text arg|] [str|unnamed text arg|]
let file = unsafePerformIO $ BL.readFile "test/C.png" let file = unsafePerformIO $ BL.readFile "test/spec/fixtures/image.png"
r <- request methodPost "/rpc/overloaded_unnamed_param" r <- request methodPost "/rpc/overloaded_unnamed_param"
[("Content-Type", "application/octet-stream"), ("Accept", "application/octet-stream")] [("Content-Type", "application/octet-stream"), ("Accept", "application/octet-stream")]
file file
View File
@@ -55,7 +55,7 @@ validateOpenApiResponse headers = do
respHeaders `shouldSatisfy` respHeaders `shouldSatisfy`
\hs -> ("Content-Type", "application/openapi+json; charset=utf-8") `elem` hs \hs -> ("Content-Type", "application/openapi+json; charset=utf-8") `elem` hs
let Just body = decode (simpleBody r) let Just body = decode (simpleBody r)
Just schema <- liftIO $ decode <$> BL.readFile "test/fixtures/openapi.json" Just schema <- liftIO $ decode <$> BL.readFile "test/spec/fixtures/openapi.json"
let args :: M.Map Text Value let args :: M.Map Text Value
args = M.fromList args = M.fromList
[ ( "schema", schema ) [ ( "schema", schema )

Some files were not shown because too many files have changed in this diff Show More