hacking/integration-test/test.sh
Artom Lifshitz 7868295f9b Fix nova integration job
Running it turned up a bunch of false positives around delayed LOG
string interpolation, so we need to fix our pattern match from
`.format` to `.format(` to avoid incorrectly catching things like
`.format_message()`.

We also add the E checks in the Nova integration tests. As we saw in
the previous commit, sometimes flake8 gets bugs that caused things
that would normally get flagged to not actually get flagged, like
lines longer than 80 chars in docstrings. By running Nova
integration with E, we make sure any such changes are caught ahead of
time.

Depends-on: https://review.opendev.org/c/openstack/nova/+/874517
Change-Id: I236a25e5380b5492009d587e76347e52ec50c09f
2023-08-13 08:40:13 +02:00

59 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Usage: test.sh openstack keystone path-to-repo
# path-to-repo is an optional parameter, if it exists
# no cloning will happen and the local directory will be used,
# the first two parameter get ignored.
# Note: you can clone from a local file with REPO_ROOT=file:////~/path/to/repo
set -x
set -e
REPO_ROOT=${REPO_ROOT:-https://git.openstack.org}
HACKING="$(pwd)"
if [[ $# -lt 2 ]] ; then
echo "Script needs at least two arguments:"
echo "$0 organization name [path-to-repo]"
exit 1
fi
org=$1
project=$2
if [[ $# -eq 3 ]] ; then
projectdir=$3
clone=0
else
projectdir=$project
clone=1
fi
if [ "$clone" = "1" ] ; then
tempdir="$(mktemp -d)"
trap "rm -rf $tempdir" EXIT
pushd $tempdir
git clone $REPO_ROOT/$org/$project --depth=1
fi
pushd $projectdir
set +e
# Install project with test-requirements so that hacking's
# local-check-factory works
pip install -r test-requirements.txt
pip install .
# Reinstall hacking, the above might have uninstalled it
pip install $HACKING
flake8 --select E,H --statistics
RET=$?
popd
if [ "$clone" = "1" ] ; then
popd
fi
exit $RET