mirror of
https://github.com/status-im/status-go.git
synced 2026-08-31 00:51:12 +00:00
tests-functional/ -> test/functional/ tests-unit-network/ -> test/unit-network/ No Go code changes beyond the two package paths. Every reference follows: Makefile targets, the pytest-lint and reliability workflows, the three Jenkinsfiles, the root Dockerfile, pyrightconfig.json, .gitignore, the benchmark and functional-test scripts, and the docs. All paths inside the moved directories are self-contained (docker compose uses `context: .`, the Python helpers resolve from __file__), so the extra level of nesting does not reach outside. refs #7067
80 lines
2.4 KiB
Bash
Executable File
80 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -o nounset
|
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
|
source "${GIT_ROOT}/scripts/colors.sh"
|
|
|
|
echo -e "${GRN}Running benchmark${RST}"
|
|
|
|
root_path="${GIT_ROOT}/test/functional"
|
|
test_results_path="${root_path}/.results/reports"
|
|
benchmark_results_path="${root_path}/.results/benchmarks"
|
|
|
|
rm -rf "${test_results_path}"
|
|
rm -rf "${benchmark_results_path}"
|
|
|
|
mkdir -p "${test_results_path}"
|
|
mkdir -p "${benchmark_results_path}"
|
|
# Create coverage directory as jenkins user
|
|
mkdir -p "${GIT_ROOT}/coverage/binary"
|
|
|
|
all_compose_files="-f ${root_path}/docker-compose.anvil.yml -f ${root_path}/docker-compose.waku.yml"
|
|
identifier=${BUILD_ID:-$(git rev-parse --short HEAD)}
|
|
project_name="status-go-func-tests-${identifier}"
|
|
image_name="statusgo-${identifier}"
|
|
|
|
# Remove orphans
|
|
echo -e "${GRN}Cleanup old containers${RST}"
|
|
docker ps -a --filter "name=status-go-func-tests-${identifier}" --filter "status=exited" -q | xargs -r docker rm -f
|
|
|
|
# Build statusgo image
|
|
echo -e "${GRN}Building status-go${RST}"
|
|
docker build . \
|
|
--build-arg "enable_go_cache=false" \
|
|
--tag "${image_name}"
|
|
|
|
# Run docker
|
|
echo -e "${GRN}Running status-go external dependencies${RST}"
|
|
docker compose -p ${project_name} ${all_compose_files} up -d --build --remove-orphans
|
|
|
|
# Set up virtual environment
|
|
venv_path="${root_path}/.venv"
|
|
|
|
if [[ -d "${venv_path}" ]]; then
|
|
echo -e "${GRN}Using existing virtual environment${RST}"
|
|
else
|
|
echo -e "${GRN}Creating new virtual environment${RST}"
|
|
python3 -m venv "${venv_path}"
|
|
fi
|
|
|
|
source "${venv_path}/bin/activate"
|
|
|
|
# Upgrade pip and install requirements
|
|
echo -e "${GRN}Installing dependencies${RST}"
|
|
pip install --upgrade pip
|
|
pip install -r "${root_path}/requirements.txt"
|
|
|
|
# Run functional tests
|
|
echo -e "${GRN}Running benchmark${RST}, HEAD: $(git rev-parse HEAD)"
|
|
pytest \
|
|
-m benchmark \
|
|
-c "${root_path}/pytest.ini" \
|
|
--log-cli-level="INFO" \
|
|
--docker_project_name="${project_name}" \
|
|
--docker-image="${image_name}" \
|
|
--benchmark-results-dir="${benchmark_results_path}" \
|
|
--junitxml="${test_results_path}/report.xml"
|
|
exit_code=$?
|
|
|
|
# Stop containers
|
|
echo -e "${GRN}Stopping docker containers${RST}"
|
|
docker compose -p ${project_name} ${all_compose_files} stop
|
|
|
|
# Cleanup containers
|
|
echo -e "${GRN}Removing docker containers${RST}"
|
|
docker compose -p ${project_name} ${all_compose_files} down
|
|
|
|
echo -e "${GRN}Testing finished${RST}"
|
|
exit $exit_code
|