Skip to content

Commit a26f904

Browse files
authored
Implement a set of scripts around performance tests (#2405)
1 parent 23a9722 commit a26f904

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

tests/performance/Makefile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
PROJECT_ROOT=../..
2+
include ${PROJECT_ROOT}/hack/help.mk
3+
4+
RUNNER_NAMESPACE?=performance-tests
5+
RUNNER_IMAGE?=europe-docker.pkg.dev/kyma-project/dev/performance-test-runner:main
6+
7+
GRAFANA_LOCAL_PORT?=3000
8+
9+
##@ Cluster
10+
11+
.PHONY: install-monitoring
12+
install-monitoring: ## Install monitoring tools in the cluster.
13+
@echo "[MAKEFILE] Installing monitoring tools..."
14+
helm upgrade --install monitoring -n monitoring --create-namespace config/
15+
16+
.PHONY: start-remote-test
17+
start-remote-test: ## Start test in the cluster using test runner image.
18+
@echo "[MAKEFILE] Recreating test namespace..."
19+
@kubectl delete namespace $(RUNNER_NAMESPACE) &>/dev/null || true
20+
@kubectl create namespace $(RUNNER_NAMESPACE) &>/dev/null || true
21+
@echo "[MAKEFILE] Running remote test..."
22+
@cat templates/test_runner_job.yaml | resource_namespace=$(RUNNER_NAMESPACE) test_runner_image=$(RUNNER_IMAGE) envsubst | kubectl apply -f -
23+
@kubectl wait --for=condition=ready pod -l job-name=performance-test-runner -n $(RUNNER_NAMESPACE) --timeout=5m
24+
25+
.PHONY: forward-grafana
26+
forward-grafana: ## Forward grafana port to localhost.
27+
@echo "[MAKEFILE] Getting grafana auth..."
28+
@echo " > Username: admin"
29+
@echo " > Password: $(shell kubectl -n monitoring get secret monitoring-grafana -o jsonpath="{.data.admin-password}" | base64 --decode)"
30+
@echo "[MAKEFILE] Forwarding grafana port to localhost:$(GRAFANA_LOCAL_PORT)..."
31+
@kubectl -n monitoring port-forward svc/monitoring-grafana $(GRAFANA_LOCAL_PORT):80
32+
33+
.PHONY: follow-remote-test
34+
follow-remote-test: ## Follow logs of remote test runner.
35+
@echo "[MAKEFILE] Following test logs..."
36+
@kubectl logs -l job-name=performance-test-runner -n $(RUNNER_NAMESPACE) -f --tail=-1
37+
@echo "[MAKEFILE] Test completed."
38+
39+
##@ Dev
40+
41+
.PHONY: start-remote-k3d-test
42+
start-remote-k3d-test: ## Build runner locally and start it on k3d cluster.
43+
@echo "[MAKEFILE] Building test runner..."
44+
@docker build -t performance-test-runner:local .
45+
@k3d image import performance-test-runner:local
46+
@RUNNER_IMAGE=performance-test-runner:local make start-remote-test
47+
48+
.PHONY: start-test
49+
start-test: ## Start test locally.
50+
@echo "[MAKEFILE] Recreating test namespace..."
51+
@kubectl delete namespace $(RUNNER_NAMESPACE) &>/dev/null || true
52+
@kubectl create namespace $(RUNNER_NAMESPACE) &>/dev/null || true
53+
@echo "[MAKEFILE] Running test..."
54+
@echo ""
55+
@NAMESPACE=$(RUNNER_NAMESPACE) ./test_runtimes.sh
56+
57+
.PHONY: start-rapid-test
58+
start-rapid-test: ## Start all rapidly locally.
59+
@RAPID=true make start-test
60+
61+
.PHONY: start-mandelbrot-test
62+
start-mandelbrot-test: ## Start mandelbrot test locally.
63+
@SCENARIO=mandelbrot make start-test
64+
65+
.PHONY: start-rapid-mandelbrot-test
66+
start-rapid-mandelbrot-test: ## Start mandelbrot test rapidly locally.
67+
@RAPID=true make start-mandelbrot-test

0 commit comments

Comments
 (0)