grafana / k6-jslib-aws

Javascript Library allowing to interact with AWS resources from k6 scripts
Apache License 2.0
18 stars 29 forks source link

Add support for Kinesis #46

Closed oleiade closed 1 year ago

oleiade commented 1 year ago

This Pull Request is based on the excellent work done by @autometa101 in #33. It introduces support for a subset of the AWS Kinesis API.

All the credit goes to @autometa101 for this, as we only refactored, slightly changed a few APIs, documented, and reorganized the code in this PR.

@autometa101, if you have the time, I would appreciate it if you could take it for a spin and let us know if it works as intended 🙇🏻

closes #33

oleiade commented 1 year ago

✋🏻 We will need to have a documentation branch ready before we merge this ✋🏻

igracia commented 1 year ago

Hi @oleiade! I was looking precisely for this support and run into your PR. Thank you! Decided to give it a try but run into some issues I've been unable to fix. Sharing here in case it helps! The tests fail with the following error

 █ 04. publish to kinesis Stream

       ✗ Exception raised "GoError: Error: Either streamName or streamARN must be provided"
        ↳  0% — ✓ 0 / ✗ 1

     █ 05. Gets an Amazon Kinesis read all data 

       ✗ Exception raised "GoError: KinesisServiceError: Invalid message body: Could not decode JSON: {
  "ShardIterator" : {
    "ShardIterator" : "AAAAAAAAAAFmqwhoAfhE8MD13BXmQX1Ih9VZi4y1LyauMGHHn7dAS6mus1maw43HnDAqCWJBITfLCVFU5Hlc2I5/bBVx/ztxgE+ql5aZ+e4bb0P7XMBe93AZdQtOznPAvjkna2+Zp1IomJ2qLEHM3y+BwbUJDGx0vxSHAKTEldoEPxTQJ+iIlXBy5yRe1ZS4vhgMXhbaMEOLIu3/h9/oO/h4iSPuGf75"
  }
}"
        ↳  0% — ✓ 0 / ✗ 1

     █ 06. Delete kinesis Stream

       ✗ Exception raised "GoError: KinesisServiceError: Invalid message body: Could not decode JSON: {
  "StreamName" : {
    "StreamName" : "kinesis-test-stream-dummy"
  }
}"
        ↳  0% — ✓ 0 / ✗ 1

I'm using Node.js v19.9.0 on an M1 MacBook. I see the tests are failing in the build system with the same message too (although the check is green?), so I'm guessing this is not something privy to my box. Can I help you debug this somehow?

oleiade commented 1 year ago

Hey @igracia 👋🏻

Thanks for taking this code out for a spin 🚗 Much appreciated! 👏🏻

We are actively looking into the errors you've reported, and I'll let you know if we could use some further support from you 🙇🏻

oleiade commented 1 year ago

@immavalls @igracia I have pushed some changes to the branch which address the issues related to the tests failing. It should at least work as intended on that front now 👍🏻 Could you please take it out for a spin and let me know if it works for you? 🙏🏻 🙇🏻

igracia commented 1 year ago

@oleiade It works for me now! I was having an issue with the putRecords request on my side this time, so it took a couple of tries before I checked your test class. Thanks for the quick fix, really appreciate it!

I'm currently running this against a localstack v2.0.1 docker container. I'm setting up all my infra through docker compose, and the goal is to be able to run load tests locally in the same way as ew'd do in any other env, hence the liking for your plugin.

igracia commented 1 year ago

LGTM! I'm having some issues with base64 encoding of protobuf data, but t's not related to this PR. Otherwise it's working great!