-
Notifications
You must be signed in to change notification settings - Fork 251
Adding realworld test dataset #2409
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a170ee2
adding realworld test dataset and first basic testing with that dataset
s3inlc edf881f
properly initialize db dump BEFORE the migrations run to make sure th…
s3inlc fc96833
adjusted migration checksums for postgres
s3inlc 5a310d0
testing both cases with most of the tests, except such which are not …
s3inlc 3ea18ec
test nearly all tests with the real-world data set as well
s3inlc abba68e
added tests querying the real dataset and do some larger queries checks
s3inlc d20cd50
Merge remote-tracking branch 'origin/master' into real-data-testing
s3inlc f589993
mark other global rescan test also as synthetic only
s3inlc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [[ $# -ne 1 ]]; then | ||
| printf 'Usage: %s <mysql|postgres>\n' "$0" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| db_system=$1 | ||
| db_container="hashtopolis-db-dev" | ||
| database="hashtopolis" | ||
| user="hashtopolis" | ||
| password="hashtopolis" | ||
| config_source="ci/testdata/config.json" | ||
| config_target="/usr/local/share/hashtopolis/config/config.json" | ||
| compose_file=".github/docker-compose.${db_system}.yml" | ||
|
|
||
| if [[ ! -f "$config_source" ]]; then | ||
| printf 'Missing testdata config: %s\n' "$config_source" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -f "$compose_file" ]]; then | ||
| printf 'Missing compose file: %s\n' "$compose_file" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| printf 'Installing real-world test config into application data volume: %s\n' "$config_target" | ||
| docker compose -f "$compose_file" run --rm --no-deps --entrypoint bash -T -u root hashtopolis-server-dev \ | ||
| -c "mkdir -p '$(dirname "$config_target")' && cp '/var/www/html/$config_source' '$config_target' && chown www-data:www-data '$config_target'" | ||
|
|
||
| wait_for_mysql() { | ||
| for _ in {1..90}; do | ||
| if docker exec "$db_container" mysql -u"$user" -p"$password" "$database" -e 'SELECT 1;' >/dev/null 2>&1; then | ||
| return 0 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| printf 'MySQL database did not become ready in time.\n' >&2 | ||
| return 1 | ||
| } | ||
|
|
||
| wait_for_postgres() { | ||
| for _ in {1..90}; do | ||
| if docker exec "$db_container" pg_isready -U "$user" -d "$database" >/dev/null 2>&1; then | ||
| return 0 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| printf 'PostgreSQL database did not become ready in time.\n' >&2 | ||
| return 1 | ||
| } | ||
|
|
||
| case "$db_system" in | ||
| mysql) | ||
| dump="ci/testdata/db_dump.mysql" | ||
| if [[ ! -f "$dump" ]]; then | ||
| printf 'Missing MySQL test dump: %s\n' "$dump" >&2 | ||
| exit 1 | ||
| fi | ||
| wait_for_mysql | ||
| printf 'Importing real-world MySQL test dump: %s\n' "$dump" | ||
| docker exec -i "$db_container" mysql -u"$user" -p"$password" "$database" < "$dump" | ||
| ;; | ||
| postgres) | ||
| dump="ci/testdata/db_dump.psql" | ||
| if [[ ! -f "$dump" ]]; then | ||
| printf 'Missing PostgreSQL test dump: %s\n' "$dump" >&2 | ||
| exit 1 | ||
| fi | ||
| wait_for_postgres | ||
| printf 'Resetting PostgreSQL schema before real-world dump import\n' | ||
| docker exec "$db_container" psql -v ON_ERROR_STOP=1 -U "$user" -d "$database" \ | ||
| -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public;' | ||
| printf 'Importing real-world PostgreSQL test dump: %s\n' "$dump" | ||
| docker exec -i "$db_container" psql -v ON_ERROR_STOP=1 -U "$user" -d "$database" < "$dump" | ||
| ;; | ||
| *) | ||
| printf 'Unsupported db system: %s\n' "$db_system" >&2 | ||
| exit 2 | ||
| ;; | ||
| esac | ||
|
|
||
| printf 'Real-world test dataset import completed.\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.