2021-09-07 15:48:58 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
2020-07-01 02:28:31 +00:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
2021-09-07 15:48:58 +00:00
|
|
|
SHELL = bash
|
|
|
|
|
2021-04-26 17:48:43 +00:00
|
|
|
OUTPUT_DIR = artifacts/
|
|
|
|
KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git
|
2021-09-07 15:48:58 +00:00
|
|
|
VENVS = $(shell ls -1d venv/*/ | sort -u | xargs basename -a)
|
2022-07-11 10:58:40 +00:00
|
|
|
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
2022-07-13 03:40:27 +00:00
|
|
|
DEV_IMAGE_PY ?= registry.spb.yadro.com/tools/pytest-neofs-x86_64:7
|
2022-07-12 08:23:48 +00:00
|
|
|
SETUP_DIR ?= $(CURDIR)/.setup
|
|
|
|
DEV_ENV_DEPLOY_DIR ?= /opt/dev-env
|
2022-07-08 17:24:55 +00:00
|
|
|
|
|
|
|
ifeq ($(shell uname -s),Darwin)
|
2022-07-11 10:58:40 +00:00
|
|
|
DOCKER_NETWORK = --network bridge -p 389:389 -p 636:636
|
2022-07-08 17:24:55 +00:00
|
|
|
endif
|
|
|
|
|
2021-09-07 15:48:58 +00:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: venvs
|
2021-04-26 17:48:43 +00:00
|
|
|
|
2021-09-07 15:48:58 +00:00
|
|
|
include venv_template.mk
|
|
|
|
|
|
|
|
run: venvs
|
2020-12-11 11:35:02 +00:00
|
|
|
@echo "⇒ Test Run"
|
2021-04-26 17:48:43 +00:00
|
|
|
@robot --timestampoutputs --outputdir $(OUTPUT_DIR) robot/testsuites/integration/
|
2020-07-01 02:28:31 +00:00
|
|
|
|
2021-09-07 15:48:58 +00:00
|
|
|
.PHONY: venvs
|
|
|
|
venvs:
|
|
|
|
$(foreach venv,$(VENVS),venv.$(venv))
|
|
|
|
|
|
|
|
$(foreach venv,$(VENVS),$(eval $(call VENV_template,$(venv))))
|
2020-07-01 02:28:31 +00:00
|
|
|
|
2022-02-14 10:57:08 +00:00
|
|
|
submodules:
|
|
|
|
@git submodule init
|
|
|
|
@git submodule update --recursive --remote
|
|
|
|
|
2021-09-07 15:48:58 +00:00
|
|
|
clean:
|
|
|
|
rm -rf venv.*
|
2021-04-26 17:48:43 +00:00
|
|
|
|
2022-07-05 07:18:37 +00:00
|
|
|
pytest-local:
|
|
|
|
@echo "⇒ Run Pytest"
|
2022-07-08 17:24:55 +00:00
|
|
|
export PYTHONPATH=$(ROOT_DIR)/neofs-keywords/lib:$(ROOT_DIR)/neofs-keywords/robot:$(ROOT_DIR)/robot/resources/lib:$(ROOT_DIR)/robot/resources/lib/python_keywords:$(ROOT_DIR)/robot/variables && \
|
2022-07-05 07:18:37 +00:00
|
|
|
python -m pytest pytest_tests/testsuites/
|
|
|
|
|
2021-04-26 17:48:43 +00:00
|
|
|
help:
|
|
|
|
@echo "⇒ run Run testcases ${R}"
|
2022-07-08 17:24:55 +00:00
|
|
|
|
2022-07-12 08:23:48 +00:00
|
|
|
.PHONY: setup-for-remote-devenv
|
|
|
|
setup-for-remote-devenv:
|
|
|
|
mkdir -p $(SETUP_DIR)
|
|
|
|
# Download services directory from remote devenv into $(SETUP_DIR)/services
|
|
|
|
scp -r root@$(DEV_ENV_HOST_NAME):$(DEV_ENV_DEPLOY_DIR)/services $(SETUP_DIR)
|
|
|
|
# Generate .env file
|
2022-07-14 07:33:45 +00:00
|
|
|
echo NEO_MAINNET_ENDPOINT=http://$(DEV_ENV_HOST_NAME):30333 > .env
|
|
|
|
echo MORPH_ENDPOINT=http://$(DEV_ENV_HOST_NAME):30334 >> .env
|
|
|
|
echo HTTP_GATE=http://$(DEV_ENV_HOST_NAME):81 >> .env
|
|
|
|
echo S3_GATE=https://$(DEV_ENV_HOST_NAME):8080 >> .env
|
|
|
|
echo NEOFS_ENDPOINT=$(DEV_ENV_HOST_NAME):8081 >> .env
|
|
|
|
# env: blockchain wallets
|
|
|
|
echo MAINNET_WALLET_PATH="/.setup/services/chain/node-wallet.json" >> .env
|
|
|
|
echo IR_WALLET_PATH="/.setup/services/ir/wallet01.json" >> .env
|
|
|
|
# env: storage nodes
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_1=$(DEV_ENV_HOST_NAME):8181 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_2=$(DEV_ENV_HOST_NAME):8182 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_3=$(DEV_ENV_HOST_NAME):8183 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_4=$(DEV_ENV_HOST_NAME):8184 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_1=$(DEV_ENV_HOST_NAME):8081 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_2=$(DEV_ENV_HOST_NAME):8082 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_3=$(DEV_ENV_HOST_NAME):8083 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_4=$(DEV_ENV_HOST_NAME):8084 >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_1="/.setup/services/storage/wallet01.json" >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_2="/.setup/services/storage/wallet02.json" >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_3="/.setup/services/storage/wallet03.json" >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_4="/.setup/services/storage/wallet04.json" >> .env
|
|
|
|
# env: SSH connection to storage node
|
|
|
|
echo STORAGE_NODE_SSH_PRIVATE_KEY_PATH="/root/.ssh/id_rsa" >> .env
|
2022-07-14 05:58:46 +00:00
|
|
|
# env: files inside storage node to make calls via SSH on that node
|
2022-07-14 07:33:45 +00:00
|
|
|
echo STORAGE_NODE_BIN_PATH="$(DEV_ENV_DEPLOY_DIR)/vendor" >> .env
|
|
|
|
echo STORAGE_NODE_CONFIG_PATH="$(DEV_ENV_DEPLOY_DIR)/services/storage/cli-cfg.yml" >> .env
|
2022-07-15 05:35:57 +00:00
|
|
|
echo STORAGE_NODE_WALLET_PATH="$(DEV_ENV_DEPLOY_DIR)/services/storage/wallet01.json" >> .env
|
2022-07-18 12:21:01 +00:00
|
|
|
echo STORAGE_NODE_PRIVATE_CONTROL_ENDPOINT="s01.neofs.devenv:8181" >> .env
|
2022-07-14 07:33:45 +00:00
|
|
|
# env: s3 gateway public key
|
|
|
|
ssh root@$(DEV_ENV_HOST_NAME) 'cd $(DEV_ENV_DEPLOY_DIR) && make env | grep NEOFS_IR_CONTRACTS_NEOFS' >> .env
|
2022-07-12 08:23:48 +00:00
|
|
|
|
2022-07-13 14:30:57 +00:00
|
|
|
.PHONY: setup-for-sbercloud
|
|
|
|
setup-for-sbercloud:
|
|
|
|
mkdir -p $(SETUP_DIR)
|
2022-07-15 11:42:01 +00:00
|
|
|
# Copy wallets from configuration directory to setup directory
|
2022-07-13 14:30:57 +00:00
|
|
|
cp -r $(CONFIG_DIR)/alphabet-wallets $(SETUP_DIR)
|
|
|
|
cp -r $(CONFIG_DIR)/wallets $(SETUP_DIR)
|
2022-07-15 11:42:01 +00:00
|
|
|
# Copy neofs-adm config to setup directory (and adjust path to wallets)
|
2022-07-14 07:33:45 +00:00
|
|
|
cat $(CONFIG_DIR)/config.yaml | sed "s|alphabet-wallets:.*|alphabet-wallets: /.setup/alphabet-wallets|" > $(SETUP_DIR)/config.yaml
|
2022-07-15 11:42:01 +00:00
|
|
|
# Generate .env file (NEO_MAINNET_ENDPOINT might be incorrect, but we don't use it)
|
2022-07-14 07:33:45 +00:00
|
|
|
echo NEO_MAINNET_ENDPOINT=http://$(NODE1):40333 > .env
|
|
|
|
echo MORPH_ENDPOINT=http://$(NODE1):40332 >> .env
|
|
|
|
echo HTTP_GATE=http://$(NODE1):8888 >> .env
|
|
|
|
echo S3_GATE=http://$(NODE1):8084 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_1=$(NODE1):40332 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_2=$(NODE2):40332 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_3=$(NODE3):40332 >> .env
|
|
|
|
echo STORAGE_CONTROL_ENDPOINT_4=$(NODE4):40332 >> .env
|
|
|
|
echo NEOFS_ENDPOINT=$(NODE1):8080 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_1=$(NODE1):8080 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_2=$(NODE2):8080 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_3=$(NODE3):8080 >> .env
|
|
|
|
echo STORAGE_RPC_ENDPOINT_4=$(NODE4):8080 >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_1="/.setup/wallets/node1-storage.json" >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_2="/.setup/wallets/node2-storage.json" >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_3="/.setup/wallets/node3-storage.json" >> .env
|
|
|
|
echo STORAGE_WALLET_PATH_4="/.setup/wallets/node4-storage.json" >> .env
|
|
|
|
echo MAINNET_WALLET_PATH="/.setup/alphabet-wallets/az.json" >> .env
|
|
|
|
echo FREE_STORAGE=true >> .env
|
|
|
|
echo NEOFS_ADM_EXEC="neofs-adm" >> .env
|
|
|
|
echo NEOFS_ADM_CONFIG_PATH="/.setup/config.yaml" >> .env
|
2022-07-13 18:17:08 +00:00
|
|
|
# env: files inside storage node to make calls via SSH on that node
|
2022-07-14 07:33:45 +00:00
|
|
|
echo STORAGE_NODE_BIN_PATH="/usr/local/bin/" >> .env
|
|
|
|
echo STORAGE_NODE_CONFIG_PATH="/tmp/conf.yaml" >> .env
|
2022-07-15 05:35:57 +00:00
|
|
|
echo STORAGE_NODE_WALLET_PATH="/etc/neofs/storage/wallet.json" >> .env
|
|
|
|
echo STORAGE_NODE_PRIVATE_CONTROL_ENDPOINT="localhost:8091" >> .env
|
2022-07-13 18:17:08 +00:00
|
|
|
# env: s3 gateway public key
|
2022-07-14 07:33:45 +00:00
|
|
|
echo S3_GATE_PUB_KEY=$(shell $(NEO_BIN_DIR)/neo-go wallet dump-keys -w $(CONFIG_DIR)/wallets/node1-s3.json | head -2 | tail -1) >> .env
|
2022-07-13 14:30:57 +00:00
|
|
|
|
2022-07-08 17:24:55 +00:00
|
|
|
.PHONY: pytest-docker
|
|
|
|
pytest-docker:
|
|
|
|
-docker ps
|
2022-07-15 05:53:07 +00:00
|
|
|
-docker rm neofs_tests_py$(BUILD_NUMBER)
|
2022-07-08 17:24:55 +00:00
|
|
|
-docker pull $(DEV_IMAGE_PY)
|
2022-07-14 07:33:45 +00:00
|
|
|
docker run -t --rm \
|
2022-07-08 17:24:55 +00:00
|
|
|
-w /tests \
|
2022-07-15 05:53:07 +00:00
|
|
|
--name neofs_tests_py$(BUILD_NUMBER) \
|
2022-07-12 08:23:48 +00:00
|
|
|
-e PYTHONPATH="/tests/neofs-keywords/lib:/tests/neofs-keywords/robot:/tests/robot/resources/lib:/tests/robot/resources/lib/python_keywords:/tests/robot/variables:/tests/pytest_tests/helpers" \
|
|
|
|
-v $(CURDIR):/tests \
|
2022-07-08 17:24:55 +00:00
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
|
-v $(NEO_BIN_DIR):/neofs \
|
2022-07-12 08:23:48 +00:00
|
|
|
-v $(SETUP_DIR):/.setup \
|
2022-07-08 17:24:55 +00:00
|
|
|
--privileged \
|
|
|
|
$(DOCKER_NETWORK) \
|
|
|
|
--env-file $(CURDIR)/.env \
|
|
|
|
$(DEV_IMAGE_PY) \
|
|
|
|
-v \
|
|
|
|
-m "$(CI_MARKERS)" \
|
|
|
|
--color=no \
|
|
|
|
--junitxml=/tests/xunit_results.xml \
|
|
|
|
--alluredir=/tests/allure_results \
|
|
|
|
--setup-show \
|
|
|
|
/tests/pytest_tests/testsuites
|