This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix broken export-data admin command and add a test for it to CI #11078
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3fadb39
remove broken reference to config.worker.worker_log_file
H-Shay 816ee42
change call to filter_events_for_client to set filter_send_to_client …
H-Shay 794e5b5
add test for checking that admin command works
H-Shay 936658b
add export_data test script to CI
H-Shay 0de9344
add changelog
H-Shay 3ced2c6
Merge branch 'develop' into fix_export_data
H-Shay cfd2244
update function call in script to match current file structure
H-Shay fdd348b
update workflow so test script runs only on one postgres version and …
H-Shay f0b099c
fix script to update database properly
H-Shay 28cb383
fix some new breaking changes to config object
H-Shay ab47a03
refactor to use RoomWorkerStore
H-Shay 7a1a462
refactor test script
H-Shay 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Test for the export-data admin command against sqlite and postgres | ||
|
||
set -xe | ||
cd `dirname $0`/../.. | ||
|
||
echo "--- Install dependencies" | ||
|
||
# Install dependencies for this test. | ||
pip install psycopg2 | ||
|
||
# Install Synapse itself. This won't update any libraries. | ||
pip install -e . | ||
|
||
echo "--- Generate the signing key" | ||
|
||
# Generate the server's signing key. | ||
python -m synapse.app.homeserver --generate-keys -c .ci/sqlite-config.yaml | ||
|
||
echo "--- Prepare test database" | ||
|
||
# Make sure the SQLite3 database is using the latest schema and has no pending background update. | ||
scripts/update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates | ||
|
||
# Run the export-data command on the sqlite test database | ||
python -m synapse.app.admin_cmd -c .ci/sqlite-config.yaml export-data @anon-20191002_181700-832:localhost:8800 \ | ||
--output-directory /tmp/export_data | ||
|
||
# Test that the output directory exists and contains the rooms directory | ||
dir="/tmp/export_data/rooms" | ||
if [ -d "$dir" ]; then | ||
echo "Command successful, this test passes" | ||
else | ||
echo "No output directories found, the command fails against a sqlite database." | ||
exit 1 | ||
fi | ||
|
||
# Create the PostgreSQL database. | ||
.ci/scripts/postgres_exec.py "CREATE DATABASE synapse" | ||
|
||
# Port the SQLite databse to postgres so we can check command works against postgres | ||
echo "+++ Port SQLite3 databse to postgres" | ||
scripts/synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml | ||
|
||
# Run the export-data command on postgres database | ||
python -m synapse.app.admin_cmd -c .ci/postgres-config.yaml export-data @anon-20191002_181700-832:localhost:8800 \ | ||
--output-directory /tmp/export_data2 | ||
|
||
# Test that the output directory exists and contains the rooms directory | ||
dir2="/tmp/export_data2/rooms" | ||
if [ -d "$dir2" ]; then | ||
echo "Command successful, this test passes" | ||
else | ||
echo "No output directories found, the command fails against a postgres database." | ||
exit 1 | ||
fi |
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 @@ | ||
Fix broken export-data admin command and add test script checking the command to CI. |
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
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.