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

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented Sep 24, 2021

  • Use sytest:bionic. Sytest:latest is two years old (do we want
    CI to push out latest at all?) and comes with Python 3.5, which we
    explictly no longer support. The script now runs under PostgreSQL 10
    as a result.
  • Pass through argv to tox and trial so we can run specific test(s) in isolation.

A few changes to make it speedier to re-run the tests:

  • Create blank DB in the container, not the script, so we don't have to
    initdb each time
  • Use a named volume to persist the tox environment, so we don't have to
    fetch and install a bunch of packages from PyPI each time

David Robertson added 3 commits September 24, 2021 11:54
- Use sytest:bionic. Sytest:latest is two years old (do we want
  CI to push out latest at all?) and comes with Python 3.5, which we
  explictly no longer support. The script now runs under PostgreSQL 10
  as a result.

A few changes to make it speedier to re-run the tests:

- Create blank DB in the container, not the script, so we don't have to
  `initdb` each time
- Use a named volume to persist the tox environment, so we don't have to
  fetch and install a bunch of packages from PyPI each time
@DMRobertson
Copy link
Contributor Author

I just tried this with

scripts-dev/test_postgresql.sh tests.replication.test_sharded_event_persister.EventPersisterShardTestCase

Which took 41 seconds on a re-run. Not bad(?)

@DMRobertson DMRobertson requested a review from a team September 24, 2021 10:58
Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'm sure this will be useful to many (setting up a postgres locally can be a little bit faffy)

@reivilibre
Copy link
Contributor

reivilibre commented Sep 24, 2021

One thing worth thinking about: as a user, how can I instruct the testing to run 20 jobs in parallel? I think we might have an ability to do this with an env var: TRIAL_FLAGS="--jobs=20", but you probably need to do special tricks to let that seep into the container?

@DMRobertson
Copy link
Contributor Author

One thing worth thinking about: as a user, how can I instruct the testing to run 20 jobs in parallel? I think we might have an ability to do this with an env var: TRIAL_FLAGS="--jobs=20", but you probably need to do special tricks to let that seep into the container?

Note that run_pg_tests.sh already has export TRIAL_FLAGS="-j 4" right before it invokes tox

@reivilibre
Copy link
Contributor

Note that run_pg_tests.sh already has export TRIAL_FLAGS="-j 4" right before it invokes tox

ah yes. Slight shame it's not configurable, but don't want to scope creep this if it's not trivial to do

David Robertson added 3 commits September 24, 2021 14:02
IDK if this is a good or idiomatic way to do things. Lots of cobbling
around searching for hints on the web.

Maybe there's some kind of fs middleware that can rewrite uids on the
fly? /shrug
@DMRobertson
Copy link
Contributor Author

Rerunning the script, I get

  • a tox environment owned by me at SYNAPSE_SRC/.tox-pg-container
    • inside that, a virtualenv and tox's logs
  • _trial_temp as usual(?), owned by me
  • matrix_synapse.egg-info as part of the installation process, owned by me
  • no files owned by anyone who isn't me, according to find . -not -uid $(id -u)

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for remembering the docs :)

Co-authored-by: reivilibre <[email protected]>
@DMRobertson DMRobertson enabled auto-merge (squash) September 24, 2021 14:11
@DMRobertson DMRobertson merged commit ea01d4c into develop Sep 24, 2021
@DMRobertson DMRobertson deleted the dmr/update-pg-test-script branch September 24, 2021 14:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants