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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --repeat option to repeat a sequence of Hurl file (and requests) #2680

Open
jcamiel opened this issue Apr 15, 2024 · 6 comments
Open

Add --repeat option to repeat a sequence of Hurl file (and requests) #2680

jcamiel opened this issue Apr 15, 2024 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Apr 15, 2024

When running a.hurl b.hurl c.hurl:

$ hurl --repeat 2 a.hurl b.hurl c.hurl

Will run

a.hurl b.hurl c.hurl a.hurl b.hurl c.hurl

In an [Options] section:

GET https://foo.com

GET https://bar.com
[Options]
repeat: 2

GET https://baz.com

Will run https://foo.com, https://bar.com, https://bar.com, https://baz.com

To discuss: --repeat-mode

We could add a cli only option --repeat-mode that takes two values: --repeat-mode=abab (default) or --repeat-mode=aabb

$ hurl --repeat 2 --repeat-mode abab a.hurl b.hurl c.hurl

=> a.hurl b.hurl c.hurl a.hurl b.hurl c.hurl

$ hurl --repeat 2 --repeat-mode aabb a.hurl b.hurl c.hurl

=> a.hurl a.hurl b.hurl b.hurl c.hurl c.hurl

@jcamiel jcamiel added the enhancement New feature or request label Apr 15, 2024
@jcamiel jcamiel added this to the 5.0.0 milestone Apr 17, 2024
@jcamiel
Copy link
Collaborator Author

jcamiel commented Apr 17, 2024

@fabricereix we could use two options --repeat to repeat a file and --repeat-all to repeat a list of file:

With one file:

$ hurl --repeat 3 a.hurl
a.hurl a.hurl a.hurl
$ hurl --repeat-all 3 a.hurl
a.hurl a.hurl a.hurl

With two files:

$ hurl --repeat 3 a.hurl b.hurl
a.hurl a.hurl a.hurl b.hurl b.hurl b.hurl
$ hurl --repeat-all 3 a.hurl b.hurl
a.hurl b.hurl a.hurl b.hurl a.hurl b.hurl

Combined:

$ hurl --repeat 2 --repeat-all 3 a.hurl b.hurl
a.hurl a.hurl b.hurl b.hurl a.hurl a.hurl b.hurl b.hurl a.hurl a.hurl b.hurl b.hurl

@0x61nas
Copy link
Contributor

0x61nas commented May 3, 2024

@jcamiel I didn't get the difference between the --repeat and --repeat-all options, from looking at the provided examples, seams like they just repeat all provided files to me (a.k.a. they are the same)

@jcamiel
Copy link
Collaborator Author

jcamiel commented May 3, 2024

When you've two files A and B, if you want to repeat 3 times these two files what is the sequence:

A B A B A B

Or

A A A B B B

It maybe not worth it to make two options, we'll chose a mode and one "mode" and do only one option --repeat

@0x61nas
Copy link
Contributor

0x61nas commented May 3, 2024

aha, reasonable somehow, but the options names made me confused

It maybe not worth it to make two options, we'll chose a mode and one "mode" and do only one option --repeat

I think we should have one option --repeat with only one default "mode", and then we can have another different option to just modify the repeat mode.

this will help us to eliminate the confusion, and it'll help us to add more "modes" like random or power-set(all the possible combinations)

@fabricereix
Copy link
Collaborator

I also quite prefer to have only one repeat to make it simpler.
Choosing the following repeat ABABAB which seems the most common in programming.

For example, in Python

>>> from itertools import repeat
>>> files = ['A', 'B']
>>> list(repeat(files, 3))
[['A', 'B'], ['A', 'B'], ['A', 'B']]

Leaving other custom repeat (such as AAABBB) to a script calling Hurl, at least for the time-being.

@fabricereix
Copy link
Collaborator

for example, to run AAABBB synchronously

hurl --repeat 3 A
hurl --repeat 3 B

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

No branches or pull requests

3 participants