Skip to content

ericfuxealth/testkube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup

Run nginx in a minikube k8s cluster.

  • port 8081 serves the normal welcome nginx page
  • port 8082 serves a slow response (rate limited to 200 bytes/s) of the page
minikube start

kubectl apply -f nginx/nginx.yaml

kubectl port-forward service/nginx  8081:8081

kubectl port-forward service/nginx  8082:8082

Run k6

brew install k6

k6 run -e hostname=localhost k6/test-all.js
k6 run -e hostname=localhost k6/test-slow.js

Install Testkube

brew install testkube
kubectl testkube install --namespace default
kubectl testkube config namespace default
kubectl get pods
kubectl-testkube get executor

Create tests

kubectl testkube create test --file k6/test-all.js --name k6-test-all
kubectl testkube create test --file k6/test-slow.js --name k6-test-slow
kubectl testkube get test
kubectl testkube run test  k6-test-all -f
kubectl testkube run test  k6-test-slow -f

Add test from github

kubectl apply -f k6/k6-executor.yaml
kubectl testkube create test --git-uri https://github.com/ericfuxealth/testkube.git --git-branch main --git-path k6 --type "k6/script" --name k6-test-git
kubectl testkube get test k6-test-git

Run test from github

kubectl testkube run test k6-test-git --args k6/test-all.js --watch
kubectl testkube run test k6-test-git --args k6/test-slow.js --watch

Create test from Postman

kubectl testkube create test --name k6-test-postman --file postman/k6.test-normal.json --type postman/collection

kubectl testkube get test k6-test-postman

kubectl testkube run test k6-test-postman --watch

Run Postman test from github

kubectl testkube create test \
  --git-uri https://github.com/ericfuxealth/testkube.git \
  --git-branch main --git-path postman/k6.test-normal.json \
  --test-content-type=git-file \
  --type "postman/collection" \
  --name k6-test-postman-git
kubectl testkube run test k6-test-postman-git  --watch

Sync test with ArgoCD

See https://kubeshop.io/blog/a-gitops-powered-kubernetes-testing-machine-with-argocd-and-testkube

Install ArgoCD See https://argo-cd.readthedocs.io/en/stable/getting_started/

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
kubectl port-forward svc/argocd-server -n argocd 8080:443
open http://localhost:8080

Install TestKube plugin

kubectl patch deployments.apps -n argocd argocd-repo-server --type json --patch-file ./argocd/patch.yml

kubectl patch -n argocd configmaps argocd-cm --patch-file argocd/argocd-plugins.yml

kubectl apply -f argocd/testkube-application.yml

TODO: didn't work: argocd error:

rpc error: code = Unknown desc = Manifest generation error (cached): `bash -c testkube generate tests-crds .` failed exit status 1

I ssh into the argocd-repo-server pods and run the "testkube" command, got this

argocd@argocd-repo-server-688499954f-xrl6t:~$ testkube generate test-crds .
⨯ setting up client type (error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable)

Create Test Suites

kubectl testkube create testsuite -f testsuite/suite1.json --name k6-local-tests
kubectl testkube get testsuite
kubectl testkube run testsuite k6-local-tests --watch

Dashboard

kubectl testkube dashboard -s default

Clean up

kubectl delete jobs `kubectl get jobs -o custom-columns=:.metadata.name`

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors