-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
[BREAKING] Create a new loop:
section and integrate it with the features of the retry:
section.
#97
Conversation
@@ -355,16 +355,55 @@ steps: | |||
[...] | |||
``` | |||
|
|||
### `steps[*].retry:` `steps.<key>.retry:` | |||
### `steps[*].loop:` `steps.<key>.loop:` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k2tzumi
To share the implementation image, I updated the README first.
I would like to hear your opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt strong feelings 👍
We believe that even though it will be difficult to integrate with the functionality of the retry: section, we will try to make sure that it is not on the same level of hierarchy as the loop: section.
### `steps[*].loop:` `steps.<key>.loop:` | |
### `steps[*].[req|greq].retry:` `steps.<key>.[req|greq].retry:` |
We believe it will be like the above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use retry:
for both db runner and exec runner.
For example, it can wait when updating values to the database asynchronously.
It is also possible to use it in the include runner to wait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, there's asynchronous processing.
loop:
section and integrate it with the features of the retry:
section.loop:
section and integrate it with the features of the retry:
section.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
retrySectionKey = "retry" | ||
loopSectionKey = "loop" | ||
deprecatedRetrySectionKey = "retry" // deprecated | ||
loopCountVarKey = "i" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nits]
How to name the key if we try to implement a counter for the index of steps[*] in a future feature addition? I was wondering.
Is there a way to concisely describe a case that references an index when testing a response in the same step?
steps:
-
req:
/get?var=foo:
get:
body: null
test: |
steps[0].res.status == 200
I wanted to be concise, e.g., to be able to refer to the index of steps[0]
by a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the same problem as you (To solve this problem, I created a step listing with a map.
How to name the key if we try to implement a counter for the index of steps[*] in a future feature addition? I was wondering.
I'm certainly wondering what to do about it.
If we were to support both Array and Map types, should there be a way to specify the current step as follows?
steps:
-
req:
/get?var=foo:
get:
body: null
test: |
current.res.status == 200
steps:
reqget:
req:
/get?var=foo:
get:
body: null
test: |
current.res.status == 200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have any ideas for naming the step[*] counter and the loop counter well, please let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were to support both Array and Map types, should there be a way to specify the current step as follows?
The current
key looks very nice, since it can be used in either Map or Array.
I'd like to respond separately from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k2tzumi Thank you very much!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k2tzumi I invited you to become a collaborator of runn!
Co-authored-by: Katsumi Kato <k2tzumi@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Katsumi Kato <k2tzumi@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
@k2tzumi If you can, I'd be happy to get your comments on whether or not it looks good for us. |
This comment has been minimized.
This comment has been minimized.
testdata/book/httpbin.yml
Outdated
steps[5].res.status == 204 | ||
# FIXME: I'd like to see the last status be 200. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the best rule for referencing the result of a loop process?
- Keep only the final result.
Currently, I think the first result is referenced. - Allow reference to the result of each loop.
steps[5].res[4].status
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the until: condition is incorrect.
- until: 'steps[5].res.status != "200"'
+ until: 'steps[5].res.status == 200'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍 c26f27c
include: | ||
path: httpbin_include.yml | ||
vars: | ||
jsonRequestBody: 'json://{{ vars.loopVars[i] }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting the json to be loaded. 😅
I will try to respond as soon as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR sent.
#101
steps: | ||
- | ||
req: | ||
/post?count={{ vars.counter }}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NOTE]
I thought I could reference the loop counter directly in the include destination, but I couldn't.
I don't think it's a problem because there are alternatives as per the test scenario.
/post?count={{ vars.counter }}: | |
/post?count={{ i }}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I could reference the loop counter directly in the include destination, but I couldn't.
Yes. Because the position of the i
variable is root, I thought it would conflict with the loop counter in the included.
I also thought parent.i
would be uncool 😄
Code Metrics Report
Details | | main (3de9ed0) | #97 (20472e4) | +/- |
|---------------------|----------------|---------------|-------|
+ | Coverage | 72.2% | 72.5% | +0.3% |
| Files | 17 | 17 | 0 |
| Lines | 1886 | 1929 | +43 |
+ | Covered | 1362 | 1399 | +37 |
- | Code to Test Ratio | 1:0.7 | 1:0.7 | -0.0 |
| Code | 3652 | 3723 | +71 |
+ | Test | 2710 | 2712 | +2 |
+ | Test Execution Time | 1m1s | 49s | -12s | Code coverage of files in pull request scope (73.2% → 73.9%)
Reported by octocov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k1LoW
LGTM!
Thank you!!!! |
From #90 (comment), I would like to create a new
loop:
section and integrate it with the features of theretry:
section.steps[*].loop:
steps.<key>.loop:
Loop settings for steps.
Simple loop usage
or
Retry
It can be used as a retry mechanism by setting a condition in the
until:
section.If the condition of
until:
is met, the loop is broken without waiting for the number ofcount:
to be run.Also, if the run of the number of
count:
completes but does not satisfy the condition ofuntil:
, then the step is considered to be failed.(
steps[*].retry:
steps.<key>.retry:
are deprecated )