Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate io-tests from bash to pytest #1682

Merged
merged 44 commits into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
02a8847
minimal scaffolding for new io tests
Dec 6, 2020
8a49e5b
tests for expected configs
Dec 6, 2020
40b2860
refactor with pathlib and parametrized fixtures
Dec 6, 2020
d2df4c8
add tests on re-dumping config
Dec 6, 2020
e4a89b6
add read secret from file tests
Dec 6, 2020
cd38b5a
plug new tests into CI
Dec 6, 2020
b3bf6e0
More green!
monacoremo Dec 6, 2020
c9ef548
Not enough green
monacoremo Dec 6, 2020
06346de
Update tests.nix
monacoremo Dec 6, 2020
e33f61a
read dburi from file
Dec 11, 2020
0948d58
test role claim key
Dec 11, 2020
1d5164f
invalid role claim keys
Dec 11, 2020
303f99c
add role claim key tests
Dec 12, 2020
7e5ca43
add styling for Python files
Dec 12, 2020
e4e29cf
add iat claim test
Dec 12, 2020
367a504
test app settings
Dec 12, 2020
b08c084
style
Dec 12, 2020
6f48c62
add app settings reload test
Dec 12, 2020
605ee12
add jwt secret reload test
Dec 12, 2020
4880356
add db schema reload test
Dec 12, 2020
d4d4492
prepare for unix domain sockets
Dec 12, 2020
5c5cafa
parametrize unix socket
Dec 13, 2020
faa79e3
add connect through socket test
Dec 13, 2020
b49292f
separate data from test code
Dec 13, 2020
c642a7e
configsdir
Dec 13, 2020
9c24cb2
parametrize tests directly
Dec 13, 2020
4981a13
properly mark globals
Dec 13, 2020
69945e7
refactor jwts and auth headers
Dec 13, 2020
6532dcc
cleanup and add docs
Dec 13, 2020
3612abf
print dumped config for wrongly accepted role key
Dec 13, 2020
9d0867b
filter output role invalid role claim keys
Dec 13, 2020
ae85b74
fix db-schemas change
Dec 13, 2020
ece3d97
separate io tests in circleci
Dec 13, 2020
7cba071
remove unneeded fix
Dec 13, 2020
4c6d234
remove old io-tests
Dec 13, 2020
f29b867
travis shot in the dark
monacoremo Dec 13, 2020
9b4eee7
Update test/io-tests/test_io.py
monacoremo Dec 13, 2020
9e1286a
Update test/io-tests/test_io.py
monacoremo Dec 13, 2020
ed0bbd9
fixture as proper yaml and with single quotes
Dec 13, 2020
3453301
filter config files
Dec 13, 2020
95645d1
add comment on SIGUSR1
Dec 13, 2020
7a99df7
add and use Postgrest session object
Dec 13, 2020
ebf03a8
Second try on travis after all!
monacoremo Dec 13, 2020
f48d7ab
Update .travis.yml
monacoremo Dec 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ result*
dist-newstyle
postgrest.hp
postgrest.prof
__pycache__
6 changes: 5 additions & 1 deletion nix/style.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ buildEnv
{ black
, buildEnv
, checkedShellScript
, git
, hlint
Expand All @@ -19,6 +20,9 @@ let
# --vimgrep fixes a bug in ag: https://github.com/ggreer/the_silver_searcher/issues/753
${silver-searcher}/bin/ag -l --vimgrep -g '\.l?hs$' . "$rootdir" \
| xargs ${stylish-haskell}/bin/stylish-haskell -i

# Format Python files
${black}/bin/black "$rootdir" 2> /dev/null
'';

# Script to check whether any uncommited changes result from postgrest-style
Expand Down
17 changes: 14 additions & 3 deletions nix/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
, postgrestStatic
, postgrestProfiled
, procps
, python3
, runtimeShell
}:
let
Expand Down Expand Up @@ -74,19 +75,29 @@ let
checkedShellScript "postgrest-test-spec-all"
(lib.concatStringsSep "\n" testRunners);

ioTestPython =
python3.withPackages (ps: [
ps.pytest
ps.requests
ps.requests-unixsocket
ps.pyjwt
ps.pyyaml
]);

testIO =
name: postgresql:
checkedShellScript
name
''
env="$(cat ${postgrest.env})"
export PATH="$env/bin:${curl}/bin:${procps}/bin:${diffutils}/bin:$PATH"
export PATH="$env/bin:$PATH"

rootdir="$(${git}/bin/git rev-parse --show-toplevel)"
cd "$rootdir"

${cabal-install}/bin/cabal v2-build ${devCabalOptions}
${cabal-install}/bin/cabal v2-exec ${withTmpDb postgresql} "$rootdir"/test/io-tests.sh
${cabal-install}/bin/cabal v2-exec ${withTmpDb postgresql} \
${ioTestPython}/bin/pytest -- -v "$rootdir"/test/io-tests "$@"
'';

testMemory =
Expand Down Expand Up @@ -117,7 +128,7 @@ buildEnv
] ++ testSpecVersions;
}
# The memory tests have large dependencies (a profiled build of PostgREST)
# and are run less often than the spec tests, so we don't include them in
# and are run less often than the spec tests, so we don't include them in
# the default test environment. We make them available through a separate attribute:
// {
memoryTests =
Expand Down
Loading