Skip to content

GarlicLabs/example_infrastructure_tests

Repository files navigation

Example infrastructre tests

This repository contains examples of tests for your platform written with k6.
The tests are part of our Automated Update. With these tests we try to validate our assumption of stable updating, supported by tests. Currently our tests cover the following infrastructure parts:

  • Node Exporter
  • Prometheus
  • Grafana
  • The integration between them
  • Some basic Kubernetes checks

Running tests

Building k6 binary

We need a few k6 extensions for our tests, following command will build a k6 binary with all needed extensions.

xk6 build \
--with github.com/grafana/xk6-ssh@latest \
--with github.com/grafana/xk6-kubernetes \
--with github.com/GarlicLabs/xk6-ansible-config-loader

Setting up configuration

We use the xk6-ansible-config-loader extension to use ansible variables in our k6 tests, to use the extension we need to setup a config.
An example of the configuration can look like this:

---

inventory:
  path: "~/ansible/prod-inventory.yaml"
  group_vars: "~/ansible/group_vars"
  host_vars: "~/ansible/host_vars"
  vault_password: "S3Cret!"

vaults:
  - path: "~/ansible/prod-vault.yaml"
    password: "S3Cret!"

var_files:
  - path: "~/ansible/ansible-vars.yaml"
    vault_password: "S3Cret!"

Running tests

Running the tests:

#Run k8s test cases
./k6 run testscases/k8s.ts

#Run grafana prom test cases
./k6 run testscases/grafana-prometheus-test.ts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published