Skip to content

Instantly share code, notes, and snippets.

View robingustafsson's full-sized avatar

Robin Gustafsson robingustafsson

View GitHub Profile
@robingustafsson
robingustafsson / jwt.js
Created October 14, 2017 20:16
Simple JWT example for k6 load testing tool
import crypto from "k6/crypto";
import encoding from "k6/encoding";
const algToHash = {
HS256: "sha256",
HS384: "sha384",
HS512: "sha512"
};
function sign(data, hashAlg, secret) {
@robingustafsson
robingustafsson / k6_CLA.md
Last active November 16, 2021 09:04
Contributor License Agreement for Load Impact AB dba k6

Contributor License Agreement

Thank you for your interest in contributing to k6 and one or more of our open source software projects (”the Software”). This contributor agreement ("Agreement") documents the rights granted by contributors to the Software. To make this Agreement effective, please sign it following the instructions at cla-assistant. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by k6.

1. Definitions

"You" (Individual) means the individual who Submits a Contribution to k6.

"You" (Entity) means any Legal Entity on behalf of whom a Contribution has been received by k6. "Legal Entity" means an entity which is not a natural person. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such Legal Entity, whether by contract or otherwise, (ii) ownership of fifty percent

@robingustafsson
robingustafsson / demo.js
Created July 18, 2019 10:16
k6 demo test script for Grafana blog post
import http from 'k6/http';
import {check, group, sleep, fail} from 'k6';
export let options = {
stages: [
{ target: 50, duration: '5s' },
{ target: 50, duration: '5s' },
],
thresholds: {
'http_req_duration': ['p(95)<500', 'p(99)<1500'],
@robingustafsson
robingustafsson / k6_CLA.md
Last active July 16, 2019 21:17
Contributor License Agreement for Load Impact k6

LOAD IMPACT, k6 Contributor License Agreement

Thank you for your interest in contributing to Load Impact and our load and performance testing tool k6 (”the Software”). This contributor agreement ("Agreement") documents the rights granted by contributors to the Software. To make this Agreement effective, please sign it following the instructions at cla-assistant. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Load Impact.

1. Definitions

"You" (Individual) means the individual who Submits a Contribution to Load Impact.

"You" (Entity) means any Legal Entity on behalf of whom a Contribution has been received by Load Impact. "Legal Entity" means an entity which is not a natural person. "Affiliates" means other Legal Entities that control, are controlled by, or under common control with that Legal Entity. For the purposes of this definition, "co

@robingustafsson
robingustafsson / LoadImpactAPI.postman_collection.json
Created March 26, 2019 15:42
Load Impact API Postman Collection
{
"info": {
"_postman_id": "ff119874-c383-48f1-90c7-386a8c5a93f0",
"name": "Load Impact Platform API Reference Documentation",
"description": "\n# Introduction\n\n<img src=\"http://online.swagger.io/validator?url=http://developers.staging.loadimpact.com/swagger.yaml\">\n\nWelcome to the Load Impact Platform API reference documentation. This documentation should be of interest to anyone who wishes to use or build upon the Load Impact performance testing platform.\nThis API gives you programmatic access to the same set of features used to power the service at [app.loadimpact.com](https://app.loadimpact.com/).\nIn practice, this means you can start tests, retrieve details of tests, and more.\n\nYou can find a postman collection of Load Impact Platform API reference documentation <a href=\"/loadimpact_api_docs_collection.json\"> here </a>.\n\n\n# Versioning\nThis documentation is valid for the latest generation of Load Impact products which use k6 as a load generator with scripting in JavaScript.\n\nThe Lo
@robingustafsson
robingustafsson / awsv4.postman_collection.json
Created March 25, 2019 09:34
Postman-to-k6 PR review: AWS v4 auth
{
"info": {
"_postman_id": "737b103a-8e4b-4cc9-8d12-5e38486dc5aa",
"name": "Postman-to-k6: AWSv4",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "AWSv4",
"event": [
@robingustafsson
robingustafsson / oauth.postman_collection.json
Created March 25, 2019 09:30
Postman-to-k6 PR review: OAuth1 auth
{
"info": {
"_postman_id": "c0b1dbfb-78eb-4b1d-9f64-4b2e881d90ec",
"name": "Postman-to-k6: OAuth",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "OAuth1",
"event": [
@robingustafsson
robingustafsson / post-processor-if-controller.jmx
Created February 1, 2019 10:04
JMeter-to-k6 PR review: Post-processors applied to children of grandparent
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
@robingustafsson
robingustafsson / stepping-thread-group.jmx
Created January 30, 2019 15:50
JMeter-to-k6 PR review: Stepping Thread Group (review 2)
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="jmeter-to-k6-stepping-thread-group" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
@robingustafsson
robingustafsson / if-controller.jmx
Created January 30, 2019 15:46
JMeter-to-k6 PR review: If-controller
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.0 r1840935">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>