This repository has been 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
Dockerised sytest #3660
Merged
Merged
Dockerised sytest #3660
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1917f74
some initial dockerfile stuff
hawkowl 03306b7
circleci
hawkowl d9e8a82
py3 as well
hawkowl b48392c
run on workflows
hawkowl c58fd2f
sqlite and postgres and proper logs
hawkowl 8a28ba2
fix tests
hawkowl 8482238
make it go green
hawkowl 6c6f628
move out the dockerfiles, update in CI
hawkowl bcb23c0
Update MANIFEST.in
hawkowl 44b8517
Update config.yml
hawkowl 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 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,38 @@ | ||
version: 2 | ||
jobs: | ||
sytestpy2: | ||
machine: true | ||
steps: | ||
- checkout | ||
- run: docker pull hawkowl/sytestpy2 | ||
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy2 | ||
- store_artifacts: | ||
path: ~/project/logs | ||
destination: logs | ||
sytestpy2postgres: | ||
machine: true | ||
steps: | ||
- checkout | ||
- run: docker pull hawkowl/sytestpy2 | ||
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 hawkowl/sytestpy2 | ||
- store_artifacts: | ||
path: ~/project/logs | ||
destination: logs | ||
sytestpy3: | ||
machine: true | ||
steps: | ||
- checkout | ||
- run: docker pull hawkowl/sytestpy3 | ||
- run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy3 | ||
- store_artifacts: | ||
path: ~/project/logs | ||
destination: logs | ||
|
||
workflows: | ||
version: 2 | ||
build: | ||
jobs: | ||
- sytestpy2 | ||
- sytestpy2postgres | ||
# Currently broken! | ||
# - sytestpy3 |
This file contains 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 |
---|---|---|
|
@@ -3,3 +3,6 @@ Dockerfile | |
.gitignore | ||
demo/etc | ||
tox.ini | ||
synctl | ||
.git/* | ||
.tox/* |
This file contains 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,26 @@ | ||
FROM debian:stretch | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt-get -qq update | ||
RUN apt-get -qq install -y python python-dev python-virtualenv python3-virtualenv python3-dev build-essential perl wget postgresql postgresql-client libpq-dev libssl-dev libz-dev libffi-dev sqlite3 libjpeg-dev libxslt1-dev git locales | ||
|
||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ | ||
dpkg-reconfigure --frontend=noninteractive locales && \ | ||
update-locale LANG=en_US.UTF-8 | ||
|
||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
RUN wget -q https://github.com/matrix-org/sytest/raw/develop/install-deps.pl | ||
RUN wget -q https://github.com/matrix-org/sytest/raw/develop/cpanfile | ||
RUN perl install-deps.pl | ||
|
||
RUN mkdir /test | ||
RUN mkdir /src | ||
RUN mkdir /logs | ||
WORKDIR /test | ||
|
||
ADD docker_sytest.sh /docker_sytest.sh | ||
ENTRYPOINT /docker_sytest.sh |
This file contains 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,3 @@ | ||
FROM hawkowl/sytest:latest | ||
|
||
ENV PYTHON=python2 |
This file contains 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,3 @@ | ||
FROM hawkowl/sytest:latest | ||
|
||
ENV PYTHON=python3.5 |
This file contains 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 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 @@ | ||
Sytests can now be run inside a Docker container. |
This file contains 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,59 @@ | ||
#! /usr/bin/env bash | ||
|
||
set -x | ||
|
||
if [ -e "/test/run-tests.pl" ] | ||
then | ||
echo "Using local sytests..." | ||
else | ||
branch_name="$(git --git-dir=/src/.git symbolic-ref HEAD 2>/dev/null)" || branch_name="(unnamed branch)" | ||
|
||
echo "Trying to get same-named sytest..." | ||
wget -q https://github.com/matrix-org/sytest/archive/$branch_name.tar.gz -O sytest.tar.gz | ||
4 | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Using $branch_name!" | ||
else | ||
echo "Using develop instead..." | ||
wget -q https://github.com/matrix-org/sytest/archive/develop.tar.gz -O sytest.tar.gz | ||
fi | ||
|
||
tar --strip-components=1 -xf sytest.tar.gz | ||
|
||
fi | ||
|
||
# PostgreSQL setup | ||
if [ -n "$POSTGRES" ] | ||
then | ||
|
||
export PGDATA=/var/lib/postgresql/data | ||
export PGUSER=postgres | ||
export POSTGRES_DB_1=pg1 | ||
export POSTGRES_DB_2=pg2 | ||
|
||
su -c '/usr/lib/postgresql/9.6/bin/initdb -E "UTF-8" --lc-collate="en_US.UTF-8" --lc-ctype="en_US.UTF-8" --username=postgres' postgres | ||
su -c '/usr/lib/postgresql/9.6/bin/pg_ctl -w -D /var/lib/postgresql/data start' postgres | ||
|
||
jenkins/prep_sytest_for_postgres.sh | ||
|
||
su -c 'psql -c "CREATE DATABASE pg1;"' postgres | ||
su -c 'psql -c "CREATE DATABASE pg2;"' postgres | ||
|
||
fi | ||
|
||
# Build the virtualenv | ||
$PYTHON -m virtualenv -p $PYTHON /venv/ | ||
/venv/bin/pip install -q --no-cache-dir -e /src/ | ||
/venv/bin/pip install -q --no-cache-dir lxml psycopg2 | ||
|
||
# Make sure all deps are installed -- this is done in the docker build so it shouldn't be too many | ||
./install-deps.pl | ||
|
||
# Run the tests | ||
./run-tests.pl -I Synapse --python=/venv/bin/python -O tap --all > results.tap | ||
|
||
# Copy out the logs | ||
cp results.tap /logs/results.tap | ||
cp server-0/homeserver.log /logs/homeserver-0.log | ||
cp server-1/homeserver.log /logs/homeserver-1.log |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be in the sytest repo rather than here?