I really liked idea behind the k6 performance tool. Currently trying to make a final choice between Locust and k6 so everything goes down to solution of one specific use case: I need to work with aws sdk in my performance scripts (for example, send SQS messages). Based on this doc (https://docs.k6.io/docs/modules#section-importing-javascript-libraries) and fact that aws js sdk compatibly with browserify, thought that it might work but it doesn't.
What I did:
git clone https://github.com/aws/aws-sdk-js.git
npm install
browserify index.js -s aws > aws.js
After that I tried to create simple k6 script using bundled sdk to test this:
import { check, sleep } from "k6";
import http from "k6/http";
import aws from "./sdk/aws-sdk-js/aws.js";
export default function() {
var s3 = new aws.S3();
s3.listBuckets(function(err, data) { console.log(err, data); });
console.log(Object.getOwnPropertyNames(aws.SQS()));
let res = http.get("https://google.com/");
check(res, {
"is status 200": (r) => r.status === 200
});
sleep(3);
};
But keep getting:
ERRO[0001] ReferenceError: escape is not defined
at /Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:282360:21(632)
at urlParse (/Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:282168:10(26))
at urlParse (/Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:276923:26(8))
at Endpoint (/Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:268402:44(89))
at initialize (/Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:273218:21(74))
at Service (/Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:273202:20(76))
at /Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:277464:36(12)
at /Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:277464:36(12)
at /Users/ybushnev/k6/k6/sdk/aws-sdk-js/aws.js:277464:36(12)
Would be very helpful for any help.
As a workaround, you should be able to use the AWS REST API and use this approach to sign your requests: https://support.loadimpact.com/4.0/test-scripting/examples/#aws-signature-v4-authentication