You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, k6 has received support for the async/await syntax. Considering that this javascript library is currently blocking and offers functionalities to users which would benefit from being asynchronous, we should consider making its APIs asynchronous indeed.
This would benefit the users as it would allow to avoid blocking the execution of their scripts over heavy operations such as downloading a file from S3. It would also benefit the overall performance of the scripts relying on AWS operations as it would allow the runtime to offload certain costly operations such as cryptographic signature.
The target API should lead to the following kind of code:
exportdefaultasyncfunction(){// List the buckets the AWS authentication configuration// gives us access to.constbuckets=awaits3.listBuckets()// If our test bucket does not exist, abort the execution.if(buckets.filter((b)=>b.name===testBucketName).length==0){exec.test.abort()}// Let's upload our test file to the bucketawaits3.putObject(testBucketName,testFileKey,testFile)// Let's list the test bucket objectsconstobjects=awaits3.listObjects(testBucketName)// And verify it does contain our test objectif(objects.filter((o)=>o.key===testFileKey).length==0){exec.test.abort()}// Let's redownload it verify it's correct, and delete itconstobj=awaits3.getObject(testBucketName,testFileKey)s3.deleteObject(testBucketName,testFileKey)}
The content you are editing has changed. Please copy your edits and refresh the page.
After running some experiments, it turns out that making the library itself async would be relatively trivial. However, the k6chaijs library doesn't seem to support the expect.to.eventually subset of features. We therefore have a dependency on it, and can't reliably implement support async/await until we get this feature set in k6chaijs.
I think I'll probably timebox a session trying to integrate the expect.to.eventually syntax to k6chaijs one of these days, and if I don't make enough progress will indeed "just" test the async behaviors without it.
Recently, k6 has received support for the
async/await
syntax. Considering that this javascript library is currently blocking and offers functionalities to users which would benefit from being asynchronous, we should consider making its APIs asynchronous indeed.This would benefit the users as it would allow to avoid blocking the execution of their scripts over heavy operations such as downloading a file from S3. It would also benefit the overall performance of the scripts relying on AWS operations as it would allow the runtime to offload certain costly operations such as cryptographic signature.
The target API should lead to the following kind of code:
Tasks
The text was updated successfully, but these errors were encountered: