fix_: docker user and statusd directory

This commit is contained in:
Igor Sirotin 2024-09-12 17:00:47 +01:00
parent 9c832fad53
commit d0ae79035b
No known key found for this signature in database
GPG Key ID: 425E227CAAB81F95
5 changed files with 30 additions and 28 deletions

View File

@ -488,8 +488,8 @@ test-verif-proxy-wrapper:
CGO_CFLAGS="$(CGO_CFLAGS)" go test -v github.com/status-im/status-go/rpc -tags gowaku_skip_migrations,nimbus_light_client -run ^TestProxySuite$$ -testify.m TestRun -ldflags $(LDFLAGS) CGO_CFLAGS="$(CGO_CFLAGS)" go test -v github.com/status-im/status-go/rpc -tags gowaku_skip_migrations,nimbus_light_client -run ^TestProxySuite$$ -testify.m TestRun -ldflags $(LDFLAGS)
#run-integration-tests: SHELL := /bin/sh # Run not in nix-shell, we need codecov #run-integration-tests: SHELL := /bin/sh # Run in nix-shell, we need codecov
run-integration-tests: export INTEGRATION_TESTS_DOCKER_UID ?= $(call sh, id -u $$USER) run-integration-tests: export INTEGRATION_TESTS_DOCKER_UID ?= $(call sh, id -u)
run-integration-tests: export INTEGRATION_TESTS_REPORT_CODECOV ?= false run-integration-tests: export INTEGRATION_TESTS_REPORT_CODECOV ?= false
run-integration-tests: run-integration-tests:
@./_assets/scripts/run_integration_tests.sh @./_assets/scripts/run_integration_tests.sh

View File

@ -3,7 +3,7 @@
source "${GIT_ROOT}/_assets/scripts/colors.sh" source "${GIT_ROOT}/_assets/scripts/colors.sh"
report_to_codecov() { report_to_codecov() {
# https://docs.codeclimate.com/docs/jenkins#jenkins-ci-builds # https://go.dev/blog/integration-test-coverage
echo -e "${GRN}Uploading coverage report to Codecov${RST}" echo -e "${GRN}Uploading coverage report to Codecov${RST}"
local tests_report_wildcard="${1}" local tests_report_wildcard="${1}"

View File

@ -9,12 +9,6 @@ echo -e "${GRN}Running integration tests${RST}"
root_path="${GIT_ROOT}/integration-tests" root_path="${GIT_ROOT}/integration-tests"
coverage_reports_path="${root_path}/coverage" coverage_reports_path="${root_path}/coverage"
test_results_path="${root_path}/reports" test_results_path="${root_path}/reports"
log_file="${root_path}/tests.log"
echo -e "${GRN}root_path:${RST} ${root_path}"
echo -e "${GRN}coverage_reports_path:${RST} ${coverage_reports_path}"
echo -e "${GRN}test_results_path:${RST} ${test_results_path}"
echo -e "${GRN}log_file:${RST} ${log_file}"
# Create directories # Create directories
mkdir -p "${GIT_ROOT}/integration-tests/coverage" mkdir -p "${GIT_ROOT}/integration-tests/coverage"
@ -23,29 +17,24 @@ mkdir -p "${GIT_ROOT}/integration-tests/coverage"
rm -rf "${coverage_reports_path}" rm -rf "${coverage_reports_path}"
rm -rf "${test_results_path}" rm -rf "${test_results_path}"
all_compose_files="-f ${root_path}/docker-compose.anvil.yml -f ${root_path}/docker-compose.test.status-go.yml"
# Run integration tests # Run integration tests
echo -e "${GRN}Running tests${RST}, HEAD: $(git rev-parse HEAD)" echo -e "${GRN}Running tests${RST}, HEAD: $(git rev-parse HEAD)"
docker-compose \ docker-compose ${all_compose_files} up -d --build --remove-orphans
-f ${root_path}/docker-compose.anvil.yml \
-f ${root_path}/docker-compose.test.status-go.yml \
up -d --build --remove-orphans > ${log_file}
# Save logs # Save logs
echo -e "${GRN}Saving logs${RST}" echo -e "${GRN}Saving logs${RST}"
docker-compose \ docker-compose ${all_compose_files} logs -f tests-rpc > "${root_path}/tests-rpc.log"
-f ${root_path}/docker-compose.anvil.yml \ docker-compose ${all_compose_files} logs status-go > "${root_path}/statusd.log"
-f ${root_path}/docker-compose.test.status-go.yml \ docker-compose ${all_compose_files} logs status-go-no-funds > "${root_path}/statusd-no-funds.log"
logs -f tests-rpc > ${log_file}
# Retrieve exit code # Retrieve exit code
exit_code=$(docker inspect integration-tests_tests-rpc_1 -f '{{.State.ExitCode}}'); exit_code=$(docker inspect integration-tests_tests-rpc_1 -f '{{.State.ExitCode}}');
# Stop and remove containers # Stop and remove containers
echo -e "${GRN}Stopping docker containers${RST}" echo -e "${GRN}Stopping docker containers${RST}"
docker-compose \ docker-compose ${all_compose_files} down
-f ${root_path}/docker-compose.anvil.yml \
-f ${root_path}/docker-compose.test.status-go.yml \
down > ${log_file}
# Early exit if tests failed # Early exit if tests failed
if [[ "$exit_code" -ne 0 ]]; then if [[ "$exit_code" -ne 0 ]]; then
@ -54,12 +43,11 @@ fi
# Prepare coverage reports # Prepare coverage reports
binary_coverage_reports_path="${coverage_reports_path}/binary" binary_coverage_reports_path="${coverage_reports_path}/binary"
#merged_coverage_reports_path="${coverage_reports_path}/merged" merged_coverage_reports_path="${coverage_reports_path}/merged"
merged_coverage_reports_path="$(mktemp -d)"
full_coverage_profile="${coverage_reports_path}/coverage.out" full_coverage_profile="${coverage_reports_path}/coverage.out"
# Clean merged reports directory # Clean merged reports directory
#mkdir -p "${merged_coverage_reports_path}" mkdir -p "${merged_coverage_reports_path}"
# Merge coverage reports # Merge coverage reports
go tool covdata merge -i="${binary_coverage_reports_path}" -o="${merged_coverage_reports_path}" go tool covdata merge -i="${binary_coverage_reports_path}" -o="${merged_coverage_reports_path}"
@ -69,6 +57,5 @@ go tool covdata textfmt -i="${merged_coverage_reports_path}" -o="${full_coverage
# Upload reports to Codecov # Upload reports to Codecov
if [[ ${INTEGRATION_TESTS_REPORT_CODECOV} == 'true' ]]; then if [[ ${INTEGRATION_TESTS_REPORT_CODECOV} == 'true' ]]; then
# Docs: https://go.dev/blog/integration-test-coverage
report_to_codecov "${test_results_path}/*.xml" "${full_coverage_profile}" "integration" report_to_codecov "${test_results_path}/*.xml" "${full_coverage_profile}" "integration"
fi fi

View File

@ -1,5 +1,6 @@
services: services:
status-go: status-go:
user: ${INTEGRATION_TESTS_DOCKER_UID}
build: build:
context: ../ context: ../
dockerfile: _assets/build/Dockerfile dockerfile: _assets/build/Dockerfile
@ -7,7 +8,14 @@ services:
build_tags: gowaku_no_rln build_tags: gowaku_no_rln
build_target: statusd build_target: statusd
build_flags: -cover -ldflags="-X github.com/status-im/status-go/params.Version= -X github.com/status-im/status-go/params.GitCommit=11f83780d -X github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true" build_flags: -cover -ldflags="-X github.com/status-im/status-go/params.Version= -X github.com/status-im/status-go/params.GitCommit=11f83780d -X github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true"
entrypoint: ["statusd", "-c", "/static/configs/config.json", "--seed-phrase=test test test test test test test test test test test junk", "--password=Strong12345"] entrypoint: [
"statusd",
"--log", "DEBUG",
"-c", "/static/configs/config.json",
"--seed-phrase", "test test test test test test test test test test test junk",
"--password", "Strong12345",
"--dir", "/tmp/status-go-data", # Keep in sync with `config.json/DataDir` value. Later this arg not be needed.
]
ports: ports:
- 3333:3333 - 3333:3333
healthcheck: healthcheck:
@ -22,6 +30,7 @@ services:
# TODO: Remove this duplication when implemented: https://github.com/status-im/status-go/issues/5803 # TODO: Remove this duplication when implemented: https://github.com/status-im/status-go/issues/5803
status-go-no-funds: status-go-no-funds:
user: ${INTEGRATION_TESTS_DOCKER_UID}
build: build:
context: ../ context: ../
dockerfile: _assets/build/Dockerfile dockerfile: _assets/build/Dockerfile
@ -29,7 +38,13 @@ services:
build_tags: gowaku_no_rln build_tags: gowaku_no_rln
build_target: statusd build_target: statusd
build_flags: -cover -ldflags="-X github.com/status-im/status-go/params.Version= -X github.com/status-im/status-go/params.GitCommit=11f83780d -X github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true" build_flags: -cover -ldflags="-X github.com/status-im/status-go/params.Version= -X github.com/status-im/status-go/params.GitCommit=11f83780d -X github.com/status-im/status-go/params.IpfsGatewayURL=https://ipfs.status.im/ -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true"
entrypoint: ["statusd", "-c", "/static/configs/config.json", "--seed-phrase=test test test test test test test test test test test takoe", "--password=Strong12345"] entrypoint: [
"statusd",
"-c", "/static/configs/config.json",
"--seed-phrase", "test test test test test test test test test test test takoe",
"--password", "Strong12345",
"--dir", "/tmp/status-go-data", # Keep in sync with `config.json/DataDir` value. Later this arg not be needed.
]
ports: ports:
- 3334:3333 - 3334:3333
healthcheck: healthcheck:

View File

@ -1,5 +1,5 @@
[pytest] [pytest]
addopts = -s -v --tb=short --junitxml=results.xml addopts = -s -v --tb=short
markers = markers =
rpc rpc