Skip to content

Conversation

squahtx
Copy link
Contributor

@squahtx squahtx commented Mar 24, 2022

Signed-off-by: Sean Quah seanq@element.io

@squahtx squahtx requested a review from a team as a code owner March 24, 2022 13:06
Comment on lines +23 to +26
# Pre-install test dependencies installed by `scripts/synapse_sytest.sh`.
RUN /venv/bin/pip install -q --no-cache-dir \
lxml psycopg2 coverage codecov tap.py coverage_enable_subprocess

Copy link
Contributor Author

@squahtx squahtx Mar 24, 2022

Choose a reason for hiding this comment

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

The relevant part of scripts/synapse_sytest.sh is

if [ -n "$OFFLINE" ]; then
# if we're in offline mode, just put synapse into the virtualenv, and
# hope that the deps are up-to-date.
#
# --no-use-pep517 works around what appears to be a pip issue
# (https://github.com/pypa/pip/issues/5402 possibly) where pip wants
# to reinstall any requirements for the build system, even if they are
# already installed.
/venv/bin/pip install --no-index --no-use-pep517 "$SYNAPSE_SOURCE"
else
# We've already created the virtualenv, but lets double check we have all
# deps.
/venv/bin/pip install -q --upgrade --no-cache-dir "$SYNAPSE_SOURCE"[redis]
/venv/bin/pip install -q --upgrade --no-cache-dir \
lxml psycopg2 coverage codecov tap.py coverage_enable_subprocess
# Make sure all Perl deps are installed -- this is done in the docker build
# so will only install packages added since the last Docker build
./install-deps.pl
fi

SyTest starts Synapse using coverage:

if( $self->{coverage} ) {
# Ensures that even --generate-config has coverage reports. This is intentional
push @synapse_command,
"-m", "coverage", "run", "--source=$self->{synapse_dir}/synapse", "--rcfile=$self->{synapse_dir}/.coveragerc";
}
push @synapse_command,
"-m", $app,
"--config-path" => $self->{paths}{config};

Copy link
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

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

LGTM. To check I understand: this should just mean that we cache these packages in the docker image, rather than having to pip install them every time?

@squahtx
Copy link
Contributor Author

squahtx commented Mar 24, 2022

LGTM. To check I understand: this should just mean that we cache these packages in the docker image, rather than having to pip install them every time?

That sounds right. We install these packages in the Docker image. The later pip install in scripts/synapse_sytest.sh becomes a no-op (up until there is an upgrade available?). Offline mode doesn't attempt to pip install them in scripts/synapse_sytest.sh, but still expects the packages* to be available.

* or at least coverage. I'm suspicious of the lxml and psycopg2 installs.

@squahtx squahtx merged commit 953c83c into develop Mar 25, 2022
@squahtx squahtx deleted the squah/fix_offline_mode branch March 25, 2022 14:44
@squahtx
Copy link
Contributor Author

squahtx commented Mar 25, 2022

Turns out I missed that we already do the install on line 17:
RUN /venv/bin/pip install -q --no-cache-dir lxml psycopg2 coverage codecov

which I broke during the poetry work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants