Skip to content

Instantly share code, notes, and snippets.

View davidmukiibi's full-sized avatar
💭
Working with DevOps work, one container at a time.

David Mukiibi davidmukiibi

💭
Working with DevOps work, one container at a time.
  • https://github.com/pluto-tv
  • Kenya
View GitHub Profile
@davidmukiibi
davidmukiibi / test.js
Created November 15, 2019 11:44
k6 performance test script
import { check, sleep } from "k6";
import http from "k6/http";
export let options = {
stages: [
{ duration: "60s", target: 10 },
{ duration: "60s", target: 0 }
],
thresholds: {
@davidmukiibi
davidmukiibi / cloud-test.js
Created November 15, 2019 11:47
cloud k6 performance test script
import { check, sleep } from "k6";
import http from "k6/http";
export let options = {
stages: [
{ duration: "60s", target: 10 },
{ duration: "60s", target: 0 }
],
thresholds: {
@davidmukiibi
davidmukiibi / config.yml
Created November 15, 2019 11:51
circleci configuration file for k6 performance tests
default: &defaults
parallelism: 1
docker:
- image: loadimpact/k6:latest
run_any_tests_here: &run_any_tests_here
run:
name: Run Tests
command: |
cd tests_folder
@davidmukiibi
davidmukiibi / changes.yml
Last active November 15, 2019 13:03
These are the changes between running k6 tests from local vs cloud
# change 1
login_loadimpact: &login_loadimpact
run:
name: Logging into loadimpact
command: |
k6 login cloud --token $K6_CLOUD_TOKEN
# change 2
k6_performance_tests: &k6_performance_tests
@davidmukiibi
davidmukiibi / cloud-config.yml
Last active November 18, 2019 03:19
This is the circleci config file that implements running k6 performance tests in the cloud mode.
default: &defaults
parallelism: 1
docker:
- image: loadimpact/k6:latest
run_any_tests_here: &run_any_tests_here
run:
name: Run Tests
command: |
cd tests_folder
@davidmukiibi
davidmukiibi / test-changes.yml
Created November 15, 2019 13:42
These are the changes in the k6 performance testing file
// The following block of code resides in the options code block
ext: {
loadimpact: {
name: "k6 cloud test!",
distribution: {
scenarioLabel1: { loadZone: "amazon:us:ashburn", percent: 100 }
}
}
}
default: &defaults
parallelism: 1
docker:
- image: loadimpact/k6:latest
k6_performance_tests: &k6_performance_tests
run:
name: Running Load Tests Using K6
command: |
k6 cloud tests/cloud-test.js
default: &defaults
parallelism: 1
docker:
- image: loadimpact/k6:latest
k6_performance_tests: &k6_performance_tests
run:
name: Running Load Tests Using K6
command: |
k6 cloud tests/cloud-test.js
## How do we enable Firewall? If we add the bash scripts as
## https://github.com/loadimpact/k6-circleci-example/tree/master/aws
## will the following works?
make_scripts_executable: &make_scripts_executable
run:
name: making scripts executable
command: |
chmod +x ./authorize_aws_security_group.sh
chmod +x ./revoke_aws_security_group.sh
pipeline {
agent any
stages {
stage('Performance Testing') {
steps {
echo 'Running K6 performance tests...'
sh 'sudo chmod +x setup.sh'
sh 'sudo ./setup.sh'
sh 'k6 run tests/test.js'
echo 'Completed Running K6 performance tests!'