feat: make helpers to configure and test cache install

This commit is contained in:
Aravinth Manivannan 2023-11-19 01:13:00 +05:30
parent aced3188b2
commit beeef3c7bd
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -19,6 +19,12 @@ define configure_locust
ansible-playbook -i $(INVENTORY) -f 10 ./ansible/locust.yml
endef
define configure_cache
. ./venv/bin/activate && \
ansible-playbook -i $(INVENTORY) -f 10 ./ansible/cache.yml
endef
define test_base
. ./venv/bin/activate && \
cd tests/ && \
@ -31,6 +37,19 @@ define test_base
endef
define test_cache
. ./venv/bin/activate && \
cd tests/cache/ && \
ANSIBLE_REMOTE_USER=root \
py.test --hosts='ansible://mcaptcha_hosts' \
-n 10 \
--verbose \
--ansible-inventory="../../${INVENTORY}" \
base.py
endef
define test_locust
. ./venv/bin/activate && \
cd tests/locust/ && \
@ -62,6 +81,13 @@ lint: ## Lint source code
conf.dos: ## Configure all DoS VMs
$(call configure_locust)
# ```bash
# INVENTORY=./terraform/dos/hosts.ini make conf.cache
# ```
conf.cache: ## Configure all cache VMs
$(call configure_cache)
# ```bash
# INVENTORY=./terraform/dos/hosts.ini make conf.ping
# ```
@ -76,5 +102,10 @@ test: ## Run all tests
test.base: ## Test base configuration on all VMs
$(call test_base)
test.cache: ## Test cache configuration
$(call test_cache)
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-].+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'