-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_test_suite.sh
executable file
·61 lines (49 loc) · 1.7 KB
/
setup_test_suite.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#
# Author: Riyad Preukschas <[email protected]>
# License: Mozilla Public License 2.0
# SPDX-License-Identifier: MPL-2.0
#
# Sets up docker-py so we can run the tests.
set -euo pipefail
# NOTE: change these to match your environment
readonly PODMAN_REPO_PATH="${PODMAN_REPO_PATH:-$HOME/src/podman}"
readonly DOCKER_PY_REPO_PATH="${DOCKER_PY_REPO_PATH:-$HOME/src/docker-py}"
readonly DOCKER_PY_VIRTUALENV_PATH="${DOCKER_PY_VIRTUALENV_PATH:-$HOME/.virtualenvs/docker-py}"
readonly LOGS_PATH="${LOGS_PATH:-${DOCKER_PY_REPO_PATH}/logs}"
function main() {
if [[ ! -d "${DOCKER_PY_REPO_PATH}" ]]; then
echo "docker-py repo missing. Please clone it first."
exit 1
fi
cd "${DOCKER_PY_REPO_PATH}"
mkdir -p "${LOGS_PATH}"
# create custom pytest config
# see https://docs.pytest.org/en/stable/reference.html#ini-options-ref
# see https://github.com/containers/podman/issues/5386#issuecomment-755298337
if [[ ! -e pytest_podman_apiv2.ini ]]; then
cat > pytest_podman_apiv2.ini <<-EOF
[pytest]
addopts =
--tb=short
-rxs
--cache-clear
-v
-k 'not ConfigAPITest and not LinkTest and not NodesTest and not PluginTest and not ServiceTest and not SwarmTest and not TestNetworksWithSwarm and not TestStore'
junit_suite_name = docker-py
junit_logging = all
junit_log_passing_tests = False
testpaths =
tests/integration/
EOF
fi
# create virtualenv
python3 -m venv "${DOCKER_PY_VIRTUALENV_PATH}"
source "${DOCKER_PY_VIRTUALENV_PATH}/bin/activate"
# install requiements in virtualenv
pip install -U -r requirements.txt
pip install -U -r test-requirements.txt
# make sure at least pytest is up-to-date
pip install -U pytest pytest-timeout mock
}
main "${@}"