feat: test for support DB and cache combinations
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Aravinth Manivannan 2023-12-12 22:53:52 +05:30
parent 713ec1dd18
commit 7e9f0a3633
Signed by: realaravinth
GPG key ID: F8F50389936984FF
2 changed files with 18 additions and 11 deletions

View file

@ -7,16 +7,17 @@ steps:
- export PATH=$PATH:/root/.local/bin - export PATH=$PATH:/root/.local/bin
- eval "$(ssh-agent -s)" - eval "$(ssh-agent -s)"
- make ci.init - make ci.init
- tofu -chdir=terraform/mcaptcha/ init
- tofu -chdir=terraform/mcaptcha/ plan -var-file="ci.tfvars" -out="mcaptcha"
- tofu -chdir=terraform/mcaptcha/ apply "mcaptcha"
- pip install virtualenv && virtualenv venv
- . venv/bin/activate && pip install ansible pytest-testinfra requests
- . venv/bin/activate && ansible-galaxy install -r ./ansible/requirements.yml
- . venv/bin/activate && ansible-playbook --become -i terraform/mcaptcha/hosts.ini ./ansible/mcaptcha.yml
- cat terraform/mcaptcha/hosts.ini - cat terraform/mcaptcha/hosts.ini
- export ANSIBLE_REMOTE_USER=root # db: mariadb cache: redis
- . venv/bin/activate && py.test --hosts="ansible://mcaptcha_hosts" --ansible-inventory=terraform/mcaptcha/hosts.ini --verbose tests/cache/base.py - . venv/bin/activate && ansible-playbook --become -i terraform/mcaptcha/hosts.ini --extra-vars "database_type=mariadb cache_type=redis" ./ansible/mcaptcha.yml
- . venv/bin/activate && py.test --hosts="ansible://mcaptcha_hosts" --ansible-inventory=terraform/mcaptcha/hosts.ini --verbose tests/mcaptcha/base.py - INVENTORY=terraform/mcaptcha/hosts.ini make test.cache
- INVENTORY=terraform/mcaptcha/hosts.ini make test.mcaptcha
# db: postgres cache: redis
- . venv/bin/activate && ansible-playbook --become -i terraform/mcaptcha/hosts.ini --extra-vars "database_type=postgres cache_type=redis" ./ansible/mcaptcha.yml
- INVENTORY=terraform/mcaptcha/hosts.ini make test.cache
- INVENTORY=terraform/mcaptcha/hosts.ini make test.mcaptcha
# embedded cache
- . venv/bin/activate && ansible-playbook --become -i terraform/mcaptcha/hosts.ini --extra-vars "database_type=postgres cache_type=embedded" ./ansible/mcaptcha.yml
- INVENTORY=terraform/mcaptcha/hosts.ini make test.mcaptcha
- make ci.clean - make ci.clean
secrets: [TEST_NODE_SSH_KEY] secrets: [TEST_NODE_SSH_KEY]

View file

@ -147,9 +147,15 @@ ci.init:
echo "deb-src [signed-by=/etc/apt/keyrings/opentofu.gpg] https://packages.opentofu.org/opentofu/tofu/any/ any main" >> /etc/apt/sources.list.d/opentofu.list echo "deb-src [signed-by=/etc/apt/keyrings/opentofu.gpg] https://packages.opentofu.org/opentofu/tofu/any/ any main" >> /etc/apt/sources.list.d/opentofu.list
apt-get update apt-get update
apt-get install -y tofu apt-get install -y tofu
tofu -chdir=terraform/mcaptcha/ init
tofu -chdir=terraform/mcaptcha/ plan -var-file="ci.tfvars" -out="mcaptcha"
tofu -chdir=terraform/mcaptcha/ apply "mcaptcha"
pip install virtualenv && virtualenv venv
. venv/bin/activate && pip install ansible pytest-testinfra requests
. venv/bin/activate && ansible-galaxy install -r ./ansible/requirements.yml
ci.clean: ci.clean:
echo yes | tofu destroy -var-file="ci.tfvars" echo yes | tofu -chdir=terraform/mcaptcha/ destroy -var-file="ci.tfvars"
./scripts/ci.sh --clean ./scripts/ci.sh --clean
help: ## Prints help for targets with comments help: ## Prints help for targets with comments