Skip to content

Commit

Permalink
add k6
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer committed Jul 11, 2023
1 parent bfa0b9f commit b96f0d2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/performance-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,28 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: "1.20"

- uses: oNaiPs/secrets-to-env-action@v1
with:
secrets: ${{ toJSON(secrets) }}

- name: Build k6 runner
run: make generate-k6

- name: Get cluster context
run: make get-cluster-context

- name: Deploy dependencies
run: make deploy

# Dummy action, replace with test execution
- name: Wait
uses: GuillaumeFalourd/wait-sleep-action@v1
with:
time: '60' # for 60 seconds
- name: Build k6 runner
run: make login-k6

- name: Build k6 runner
run: make excute-k6

- name: Cleanup dependencies
run: make undeploy
31 changes: 28 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,27 @@ TF_AZURE_RESOURCE_GROUP ?= resource_group
TF_GRAFANA_PROMETHEUS_URL ?= url
TF_GRAFANA_PROMETHEUS_USER ?= user
TF_GRAFANA_PROMETHEUS_PASSWORD ?= password
TF_GRAFANA_TOKEN ?= token

KEDA_VERSION ?= main

.PHONY:
##################################################
# Kubernetes context #
##################################################

az-login:
@az login --service-principal -u $(TF_AZURE_SP_APP_ID) -p "$(AZURE_SP_KEY)" --tenant $(TF_AZURE_SP_TENANT)

.PHONY: get-cluster-context
get-cluster-context: az-login ## Get Azure cluster context.
@az aks get-credentials \
--name $(TEST_CLUSTER_NAME) \
--subscription $(TF_AZURE_SUBSCRIPTION) \
--resource-group $(TF_AZURE_RESOURCE_GROUP)

##################################################
# Deployments #
##################################################

deploy: deploy-keda deploy-prometheus

undeploy: undeploy-prometheus undeploy-keda
Expand Down Expand Up @@ -52,4 +59,22 @@ deploy-prometheus:

undeploy-prometheus:
helm uninstall prometheus -n performance-prometheus
kubectl delete ns performance-prometheus
kubectl delete ns performance-prometheus

##################################################
# Grafana k6 #
##################################################

generate-k6:
go install go.k6.io/xk6/cmd/xk6@latest
xk6 build \
--output /usr/local/bin/k6 \
--with github.com/szkiba/xk6-yaml@latest \
--with github.com/grafana/xk6-kubernetes \
--with github.com/grafana/xk6-disruptor

login-k6:
@k6 login cloud --token $(TF_GRAFANA_TOKEN)

excute-k6:
k6 run --out cloud test.js

0 comments on commit b96f0d2

Please sign in to comment.