Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for repeat-until and microsecond delays #173

Open
ghost opened this issue Mar 14, 2023 · 0 comments
Open

support for repeat-until and microsecond delays #173

ghost opened this issue Mar 14, 2023 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 14, 2023

Hi, I like your tool! My infra not so much, but that's the whole idea isn't it 馃槃

I want to use it to loadtest a poc. I have an app exposing a HTTP API. It also has a async/background processor. When I create a 'payment' using the API it's stored in a db with status "pending" and the transaction id is pushed to a queue, which is consumed by the background processor. This processor will do 'something' and update the payment status to "complete" or "rejected".

Now I'd like to use drill to simulate a real scenario using this pseudo plan:

request /create-payment

for {
    request /get-payment-status
    break if body.status != "pending"
    sleep 50ms
}

I could not find a "repeat until assertion fails/succeeds" or "jump to step X if assertion fails". Is this maybe something you would be willing to implement?

So I tried next best thing: I tried to mock the loop by just doing the request 5 times, like:

  - name: get payment status
    request:
      url: /get-payment-status
      method: POST
      body: '{ "transaction_id": "{{ create_payment.body.transaction_id }}" }'
    delay:
      seconds: 0.05
    with_items:
    - 1
    - 2
    - 3
    - 4
    - 5

This did not work, because:

  • the combination of request and delay does not work
  • (later I noticed the 'delay' was actually ignored, because using seconds: 0.05 causes a panic, because the value is expected to be an i64. It would be awesome to have float or microsecond support)

Then I tried moving the request + separate delay into a snippet:

- name: get payment status
  request:
    url: /get-payment-status
    method: POST
    body: '{ "transaction_id": "{{ create_payment.body.transaction_id }}" }'

- name: sleep
  delay:
    seconds: 1

... and include it, like:

  - name: get payment status
    include: get-payment-status.yml
    with_items:
    - 1
    - 2
    - 3
    - 4
    - 5

But it seems the combination "include" and "with" is not supported.

So, for now I have to revert to:

  - name: get payment status
    include: get-payment-status.yml

  - name: get payment status
    include: get-payment-status.yml

  - name: get payment status
    include: get-payment-status.yml

  - name: get payment status
    include: get-payment-status.yml

  - name: get payment status
    include: get-payment-status.yml

Love to hear your suggestions. Maybe I am unaware of some relevant features?

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants