-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New functionality Retry test Rename functions RequestRepeat* to RequestRetry* Fix broken tests --------- Co-authored-by: Sam B. <sambenattar@gmail.com> Co-authored-by: Samuel Benattar <samuel.benattar@bytedance.com>
- Loading branch information
1 parent
b1e4e33
commit 059c650
Showing
21 changed files
with
719 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cute | ||
|
||
import "time" | ||
|
||
// Retry is a function for configure test repeat | ||
// if response.Code != Expect.Code or any of asserts are failed/broken than test will repeat counts with delay. | ||
// Default delay is 1 second. | ||
func (qt *cute) Retry(count int) MiddlewareRequest { | ||
if count < 1 { | ||
panic("count must be greater than 0") | ||
} | ||
|
||
qt.tests[qt.countTests].Retry.MaxAttempts = count | ||
|
||
return qt | ||
} | ||
|
||
// RetryDelay set delay for test repeat. | ||
// if response.Code != Expect.Code or any of asserts are failed/broken than test will repeat counts with delay. | ||
// Default delay is 1 second. | ||
func (qt *cute) RetryDelay(delay time.Duration) MiddlewareRequest { | ||
if delay < 0 { | ||
panic("delay must be greater than or equal to 0") | ||
} | ||
|
||
qt.tests[qt.countTests].Retry.Delay = delay | ||
|
||
return qt | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.