FutureSharks / invokust

A wrapper for locust to allow running load tests in python or on AWS Lambda
MIT License
158 stars 42 forks source link

AWS deployment fails #41

Closed asantoz closed 3 years ago

asantoz commented 4 years ago

Hi mates,

Following the readme tutorial to deploy on AWS lambda I got the following error when I'm trying to invoke

[ERROR] 2020-07-14T18:04:00.80Z bf187cde-4c12-46ed-b185-b0be7fe04c1f Locust exception TypeError("create_settings() got an unexpected keyword argument 'num_requests'")

Any idea?

csillab commented 4 years ago

Can you please share the following:

Thanks.

asantoz commented 4 years ago

Hi @CsilLAB ,

I'm using the latest version on pip (0.73) and I'm using the same files locustfile_example.py and lambda_locust.py that are on the repository. The create_settingsinvocation is here

When in search in python-packages folder seems pip is pulling to me locust dependency version 0.13.5 it's correct?

Thanks 🙏

csillab commented 4 years ago

I'll try to reproduce it tomorrow. I am unsure at the moment where the num_requests param is coming from. :)

There has been some changes in the code and in the example between invokust version 0.73 and 1.0 which is the current master now. Are you using the example in the master or from the 0.73 tagged version?

asantoz commented 4 years ago

Nice @CsilLAB :) I'm using master version.

csillab commented 4 years ago

Can you try select the right tag (0.73) and see if that example works for you? If that does not work, still happy to take a look tomorrow.

asantoz commented 4 years ago

With tag 0.73 example works well 🎉

Some things I have to diverge from the documentation examples, let's take a look 😃

Invoke command

The only thing that doesn't work, is this command 👇

aws lambda invoke --function-name lambda_locust --invocation-type RequestResponse --payload '{"locustfile": "locustfile_example.py", "host":"https://example.com", "num_requests":"20", "num_clients": "1", "hatch_rate": "1", "run_time":"3m"}' output.txt

Which gave me this error 💥

Invalid base64: "{"locustfile": "locustfile_example.py", "host":"https://example.com", "num_requests":"20", "num_clients": "1", "hatch_rate": "1", "run_time":"3m
"}"

I used this argument to workaround that --cli-binary-format raw-in-base64-out.

Invoke Payload

It seems the payload has some incompatibilities on number_request field returning the error

Locust exception TypeError("create_settings() got an unexpected keyword argument 'num_requests'",)

but remove them it works like a charm 😄

Make sense to create a PR to edit these "possible" issues on documentation? About version 1.0a is already advisable to use?

Thanks a lot for your attention @CsilLAB

csillab commented 4 years ago

Nice, thanks for the detailed info :) I am glad you could make it work.

I'd love for someone to test 1.0a0 "live". That's compatible with the new major release of locust. Please report any issues with it and happy to take a look in my free time :)

That num_requests is definitely wrong there. A PR is welcome to fix it up for master, seems to be wrong there too. :)

FutureSharks commented 3 years ago

I will close this now 🙂