grafana / k6-jslib-aws

Javascript Library allowing to interact with AWS resources from k6 scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lib does not honor scheme key in AWSConfig Object

MarkCupitt opened this issue · comments

Im trying to test k6 locally with a Minio Standalone server installed on the same machine

The AWSConfig Object supports the Normal S3 scheme key that can be set to 'http || https'

    /**
     * The HTTP scheme to use when connecting to AWS.
     *
     * @type {HTTPScheme} ['https']
     */
    scheme: HTTPScheme = 'https'

Here is the type declaration

/**
 * Type representing HTTP schemes
 */
export type HTTPScheme = 'http' | 'https'

however it appears that the functions do not honor this setting, for example

    listBuckets(): Array<S3Bucket> {
        const method = 'GET'

        const signedRequest: SignedHTTPRequest = this.signature.sign(
            {
                method: 'GET',
                protocol: 'https',  <============= Hard Coded
                hostname: this.host,
                path: '/',
                headers: {},
            },
            {}
        )

I have tried using minio in set up for ssl for a self signed cert but the lib reports a tls error (pretty normal)

Is there a way to achieve this? I would expect this is a normal dev scenario, and am hoping for a way to make this work

Many thanks

I have forked the repo and done the necessary mods, I don't have a local setup to run the tests, also found another issue where the bucket was prepended to the url that broke DNS on a local Minio Instance

Happy to provide a Pull Request if you want to see what we did, to make it work, might be worth it for future K6 use, as we will be using K6 for testing in Kubernetes, and it will all be http

Hey @MarkCupitt, it looks like you're correct 🤝 We have fixed a couple of issues regarding signature in the last few weeks, and we probably have overlooked this. I believe we had proper support for the scheme prior to that, but I might be wrong.

If you have the bandwidth for it, a Pull Request addressing this would be much appreciated, otherwise I'll probably try to address this in the close future indeed. Let me know 🙇🏻‍♂️

I believe this is now fixed, and will land in version 0.8.0. Closing this. Feel free to reopen if you still experience the issue.