Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix coverage in sytest and use plugins for buildkite #5922

Merged
merged 101 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
4071317
first cut of structured logging
hawkowl Jul 13, 2019
0ea4fb1
remove deprecated options, command line options, and simplify the log…
hawkowl Jul 13, 2019
af7bc1c
this should be true
hawkowl Jul 13, 2019
83bf10c
cleanup
hawkowl Jul 13, 2019
9c19dc3
remove disused arguments from workers too
hawkowl Jul 13, 2019
c19f2d5
Merge branch 'hawkowl/prune-logging-options' into hawkowl/structured-…
hawkowl Jul 13, 2019
32b9dd0
fix and push up
hawkowl Jul 13, 2019
83507eb
fix
hawkowl Jul 13, 2019
5cec494
update to use 18.9
hawkowl Jul 13, 2019
69cd070
fix sytests?
hawkowl Jul 15, 2019
51048fb
fix sytests?
hawkowl Jul 15, 2019
0b76783
make a misc
hawkowl Jul 15, 2019
9f5d825
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 18, 2019
47820c5
fix
hawkowl Jul 18, 2019
5260a8b
fix
hawkowl Jul 18, 2019
586fd94
fix
hawkowl Jul 18, 2019
50fcd60
fix
hawkowl Jul 18, 2019
534b15d
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 23, 2019
ae34f25
review comments
hawkowl Jul 23, 2019
34b3fce
review comments
hawkowl Jul 23, 2019
ba5b355
use native python read
hawkowl Jul 23, 2019
64c5cdb
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 26, 2019
d1fc0ff
set the log level on the namespace too
hawkowl Jul 26, 2019
fa764c6
review comments
hawkowl Jul 26, 2019
b19156a
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 29, 2019
6b4a540
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 29, 2019
2fbc0e1
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 30, 2019
aafc342
fix
hawkowl Jul 31, 2019
cdb8a72
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Jul 31, 2019
755d7e8
more test
hawkowl Jul 31, 2019
fb9b18a
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Aug 7, 2019
680fdee
fix
hawkowl Aug 7, 2019
db1b1b3
tests
hawkowl Aug 7, 2019
92289a7
fix
hawkowl Aug 7, 2019
e7c62b5
pass in a proper lang
hawkowl Aug 7, 2019
55391d2
try this to see if it'll go faster
hawkowl Aug 7, 2019
b2fa4ad
docs:
hawkowl Aug 7, 2019
9cf3c28
docs
hawkowl Aug 7, 2019
673d380
docs
hawkowl Aug 7, 2019
aae792d
more test
hawkowl Aug 7, 2019
b50d3a9
more test
hawkowl Aug 7, 2019
03ac5b4
fluentd log to export on console
hawkowl Aug 8, 2019
d10b9b8
fix
hawkowl Aug 8, 2019
51b3e81
fix
hawkowl Aug 8, 2019
232064e
cleanups
hawkowl Aug 8, 2019
d004e93
style fix
hawkowl Aug 8, 2019
5bbc8e7
docs and typing
hawkowl Aug 9, 2019
b611e53
run mypy and check for errors
hawkowl Aug 9, 2019
77f2334
run mypy and check for errors
hawkowl Aug 9, 2019
eb3c75d
add it to CI
hawkowl Aug 9, 2019
71d695a
docs
hawkowl Aug 9, 2019
589463f
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Aug 27, 2019
04f084c
some introductory logs
hawkowl Aug 27, 2019
8697d51
failing test
hawkowl Aug 27, 2019
4477c69
failing test
hawkowl Aug 27, 2019
2684627
Merge remote-tracking branch 'origin/develop' into hawkowl/structured…
hawkowl Aug 28, 2019
9864220
fix the test
hawkowl Aug 28, 2019
c400d15
fix the tests
hawkowl Aug 28, 2019
267501a
fix mypy
hawkowl Aug 28, 2019
518e48e
fix old tests
hawkowl Aug 28, 2019
0a0845f
fix old tests
hawkowl Aug 28, 2019
30895a6
move out annotations
hawkowl Aug 28, 2019
cd688b2
changelog
hawkowl Aug 28, 2019
b61a746
Merge remote-tracking branch 'origin/develop' into hawkowl/coverage-s…
hawkowl Aug 28, 2019
df67c43
fix use of entrypoint
hawkowl Aug 28, 2019
2dadfea
use codecov plugin
hawkowl Aug 28, 2019
8df5643
fixes for multiple workers
hawkowl Aug 28, 2019
22f79b1
try and make it more consistent
hawkowl Aug 29, 2019
da6abb7
bump
hawkowl Aug 29, 2019
c3f0913
bump
hawkowl Aug 29, 2019
85a7d66
bump
hawkowl Aug 29, 2019
22d9a2b
fix
hawkowl Aug 29, 2019
58cd1fc
fix
hawkowl Aug 29, 2019
ad57811
fix
hawkowl Aug 29, 2019
921767e
fix
hawkowl Aug 29, 2019
ac3be59
fix
hawkowl Aug 29, 2019
cc37876
fix
hawkowl Aug 29, 2019
e509498
fix
hawkowl Aug 29, 2019
73d7e4f
fix
hawkowl Aug 29, 2019
afb0591
fix
hawkowl Aug 29, 2019
5d076c2
fix
hawkowl Aug 29, 2019
6d37d64
fix
hawkowl Aug 29, 2019
5d48a2a
fix
hawkowl Aug 29, 2019
001246b
fix
hawkowl Aug 29, 2019
858fd1e
fix
hawkowl Aug 29, 2019
9657c1f
fix
hawkowl Aug 29, 2019
ce2e31d
fix
hawkowl Aug 29, 2019
4ed4e57
fix
hawkowl Aug 29, 2019
48b7498
fix
hawkowl Aug 29, 2019
bcb85fc
fix
hawkowl Aug 29, 2019
b5a8ed3
fix
hawkowl Aug 29, 2019
efedb7e
fix
hawkowl Aug 29, 2019
25260e4
fix
hawkowl Aug 29, 2019
49b3f37
fix
hawkowl Aug 29, 2019
d61fc4c
fix
hawkowl Aug 29, 2019
2100eba
fix
hawkowl Aug 29, 2019
86a57a8
fix
hawkowl Aug 29, 2019
d658d76
fix
hawkowl Aug 29, 2019
1217764
fix
hawkowl Aug 29, 2019
126764d
fix
hawkowl Aug 29, 2019
a8896bf
fix
hawkowl Aug 29, 2019
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
4 changes: 2 additions & 2 deletions .buildkite/docker-compose.py35.pg95.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ services:
SYNAPSE_POSTGRES_HOST: postgres
SYNAPSE_POSTGRES_USER: postgres
SYNAPSE_POSTGRES_PASSWORD: postgres
working_dir: /app
working_dir: /src
volumes:
- ..:/app
- ..:/src
4 changes: 2 additions & 2 deletions .buildkite/docker-compose.py37.pg11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ services:
SYNAPSE_POSTGRES_HOST: postgres
SYNAPSE_POSTGRES_USER: postgres
SYNAPSE_POSTGRES_PASSWORD: postgres
working_dir: /app
working_dir: /src
volumes:
- ..:/app
- ..:/src
4 changes: 2 additions & 2 deletions .buildkite/docker-compose.py37.pg95.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ services:
SYNAPSE_POSTGRES_HOST: postgres
SYNAPSE_POSTGRES_USER: postgres
SYNAPSE_POSTGRES_PASSWORD: postgres
working_dir: /app
working_dir: /src
volumes:
- ..:/app
- ..:/src
2 changes: 1 addition & 1 deletion .buildkite/merge_base_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git config --global user.name "A robot"

# Fetch and merge. If it doesn't work, it will raise due to set -e.
git fetch -u origin $GITBASE
git merge --no-edit origin/$GITBASE
git merge --no-edit --no-commit origin/$GITBASE

# Show what we are after.
git --no-pager show -s
84 changes: 73 additions & 11 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
env:
CODECOV_TOKEN: "2dd7eb9b-0eda-45fe-a47c-9b5ac040045f"
COVERALLS_REPO_TOKEN: wsJWOby6j0uCYFiCes3r0XauxO27mx8lD

steps:

- command:
- "python -m pip install tox"
- "tox -e check_codestyle"
label: "\U0001F9F9 Check Style"
plugins:
- docker#v3.0.1:
image: "python:3.6"
mount-buildkite-agent: false

- command:
- "python -m pip install tox"
Expand All @@ -18,6 +18,7 @@ steps:
plugins:
- docker#v3.0.1:
image: "python:3.6"
mount-buildkite-agent: false

- command:
- "python -m pip install tox"
Expand All @@ -26,6 +27,7 @@ steps:
plugins:
- docker#v3.0.1:
image: "python:3.6"
mount-buildkite-agent: false

- command:
- "python -m pip install tox"
Expand All @@ -36,6 +38,7 @@ steps:
- docker#v3.0.1:
image: "python:3.6"
propagate-environment: true
mount-buildkite-agent: false

- command:
- "python -m pip install tox"
Expand All @@ -44,6 +47,7 @@ steps:
plugins:
- docker#v3.0.1:
image: "python:3.6"
mount-buildkite-agent: false

- command:
- "python -m pip install tox"
Expand All @@ -52,21 +56,26 @@ steps:
plugins:
- docker#v3.0.1:
image: "python:3.5"
mount-buildkite-agent: false

- wait

- command:
- "apt-get update && apt-get install -y python3.5 python3.5-dev python3-pip libxml2-dev libxslt-dev zlib1g-dev"
- "python3.5 -m pip install tox"
- "tox -e py35-old,codecov"
- "tox -e py35-old,combine"
label: ":python: 3.5 / SQLite / Old Deps"
env:
TRIAL_FLAGS: "-j 2"
LANG: "C.UTF-8"
plugins:
- docker#v3.0.1:
image: "ubuntu:xenial" # We use xenail to get an old sqlite and python
image: "ubuntu:xenial" # We use xenial to get an old sqlite and python
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -76,14 +85,18 @@ steps:

- command:
- "python -m pip install tox"
- "tox -e py35,codecov"
- "tox -e py35,combine"
label: ":python: 3.5 / SQLite"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.0.1:
image: "python:3.5"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -93,14 +106,18 @@ steps:

- command:
- "python -m pip install tox"
- "tox -e py36,codecov"
- "tox -e py36,combine"
label: ":python: 3.6 / SQLite"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.0.1:
image: "python:3.6"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -110,14 +127,18 @@ steps:

- command:
- "python -m pip install tox"
- "tox -e py37,codecov"
- "tox -e py37,combine"
label: ":python: 3.7 / SQLite"
env:
TRIAL_FLAGS: "-j 2"
plugins:
- docker#v3.0.1:
image: "python:3.7"
workdir: "/src"
mount-buildkite-agent: false
propagate-environment: true
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -131,12 +152,14 @@ steps:
env:
TRIAL_FLAGS: "-j 8"
command:
- "bash -c 'python -m pip install tox && python -m tox -e py35-postgres,codecov'"
- "bash -c 'python -m pip install tox && python -m tox -e py35-postgres,combine'"
plugins:
- docker-compose#v2.1.0:
run: testenv
config:
- .buildkite/docker-compose.py35.pg95.yaml
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -150,12 +173,14 @@ steps:
env:
TRIAL_FLAGS: "-j 8"
command:
- "bash -c 'python -m pip install tox && python -m tox -e py37-postgres,codecov'"
- "bash -c 'python -m pip install tox && python -m tox -e py37-postgres,combine'"
plugins:
- docker-compose#v2.1.0:
run: testenv
config:
- .buildkite/docker-compose.py37.pg95.yaml
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -169,20 +194,21 @@ steps:
env:
TRIAL_FLAGS: "-j 8"
command:
- "bash -c 'python -m pip install tox && python -m tox -e py37-postgres,codecov'"
- "bash -c 'python -m pip install tox && python -m tox -e py37-postgres,combine'"
plugins:
- docker-compose#v2.1.0:
run: testenv
config:
- .buildkite/docker-compose.py37.pg11.yaml
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
limit: 2
- exit_status: 2
limit: 2


- label: "SyTest - :python: 3.5 / SQLite / Monolith"
agents:
queue: "medium"
Expand All @@ -195,6 +221,16 @@ steps:
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: ["/bin/sh", "-e", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.2.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/coverage.xml" ]
- matrix-org/annotate:
path: "logs/annotate.md"
class: "error"
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -216,6 +252,16 @@ steps:
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: ["/bin/sh", "-e", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.2.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/coverage.xml" ]
- matrix-org/annotate:
path: "logs/annotate.md"
class: "error"
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
Expand All @@ -240,9 +286,25 @@ steps:
propagate-environment: true
always-pull: true
workdir: "/src"
entrypoint: ["/bin/sh", "-e", "-c"]
mount-buildkite-agent: false
volumes: ["./logs:/logs"]
- artifacts#v1.2.0:
upload: [ "logs/**/*.log", "logs/**/*.log.*", "logs/coverage.xml" ]
- matrix-org/annotate:
path: "logs/annotate.md"
class: "error"
- matrix-org/coveralls#v1.0:
parallel: "true"
retry:
automatic:
- exit_status: -1
limit: 2
- exit_status: 2
limit: 2

- wait: ~
continue_on_failure: true

- label: Trigger webhook
command: "curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d \"payload[build_num]=$BUILDKITE_BUILD_NUMBER&payload[status]=done\""
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[run]
branch = True
parallel = True
include = synapse/*
include=$TOP/synapse/*
data_file = $TOP/.coverage

[report]
precision = 2
1 change: 1 addition & 0 deletions changelog.d/5922.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Buildkite pipeline to use plugins instead of buildkite-agent commands.
22 changes: 9 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ deps =
python-subunit
junitxml
coverage
coverage-enable-subprocess
parameterized

# cyptography 2.2 requires setuptools >= 18.5
Expand Down Expand Up @@ -43,13 +44,13 @@ whitelist_externals =
setenv =
{[base]setenv}
postgres: SYNAPSE_POSTGRES = 1
TOP={toxinidir}

passenv = *

commands =
/usr/bin/find "{toxinidir}" -name '*.pyc' -delete
# Add this so that coverage will run on subprocesses
sh -c 'echo "import coverage; coverage.process_startup()" > {envsitepackagesdir}/../sitecustomize.py'
{envbindir}/coverage run "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}

# As of twisted 16.4, trial tries to import the tests as a package (previously
Expand All @@ -75,8 +76,6 @@ commands =
# )
usedevelop=true



# A test suite for the oldest supported versions of Python libraries, to catch
# any uses of APIs not available in them.
[testenv:py35-old]
Expand All @@ -88,6 +87,7 @@ deps =
mock
lxml
coverage
coverage-enable-subprocess

commands =
/usr/bin/find "{toxinidir}" -name '*.pyc' -delete
Expand All @@ -96,15 +96,11 @@ commands =
# OpenSSL 1.1 compiled cryptography (as older ones don't compile on Travis).
/bin/sh -c 'python -m synapse.python_dependencies | sed -e "s/>=/==/g" -e "s/psycopg2==2.6//" -e "s/pyopenssl==16.0.0/pyopenssl==17.0.0/" | xargs -d"\n" pip install'

# Add this so that coverage will run on subprocesses
/bin/sh -c 'echo "import coverage; coverage.process_startup()" > {envsitepackagesdir}/../sitecustomize.py'

# Install Synapse itself. This won't update any libraries.
pip install -e .

{envbindir}/coverage run "{envbindir}/trial" {env:TRIAL_FLAGS:} {posargs:tests} {env:TOXSUFFIX:}


[testenv:packaging]
skip_install=True
deps =
Expand Down Expand Up @@ -137,15 +133,15 @@ basepython = python3.6
[testenv:check-sampleconfig]
commands = {toxinidir}/scripts-dev/generate_sample_config --check

[testenv:codecov]
[testenv:combine]
skip_install = True
deps =
coverage
codecov
commands =
whitelist_externals =
bash
commands=
coverage combine
coverage xml
codecov -X gcov
coverage report

[testenv:mypy]
basepython = python3.5
Expand All @@ -155,4 +151,4 @@ deps =
extras = all
commands = mypy --ignore-missing-imports \
synapse/logging/_structured.py \
synapse/logging/_terse_json.py
synapse/logging/_terse_json.py