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

feat(wait): strategy walk #2895

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/features/wait/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ If the default 60s timeout is not sufficient, it can be updated with the `WithSt
Besides that, it's possible to define a poll interval, which will actually stop 100 milliseconds the test execution.

If the default 100 milliseconds poll interval is not sufficient, it can be updated with the `WithPollInterval(pollInterval time.Duration)` function.

## Modifying request strategies

It's possible for options to modify `ContainerRequest.WaitingFor` using
[Walk](sql.md).
9 changes: 8 additions & 1 deletion docs/features/wait/walk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

Walk walks the strategies tree and calls the visit function for each node.
stevenh marked this conversation as resolved.
Show resolved Hide resolved

This allows modules to easily amend default wait strategies, updating or
removing specific strategies based on requirements of functional options.

For example removing a TLS strategy if a functional option enabled insecure mode
or changing the location of the certificate based on the configured user.

mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
If visit function returns `wait.VisitStop`, the walk stops.
If visit function returns `wait.VisitRemove`, the current node is removed.

## Walk removing entries

The following example shows how to remove a strategy based on its type.
<!--codeinclude-->
[Walk a strategy and remove the all FileStrategy entries found](../../../wait/walk_test.go) inside_block:walkRemoveFileStrategy
[Remove FileStrategy entries](../../../wait/walk_test.go) inside_block:walkRemoveFileStrategy
<!--/codeinclude-->
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ nav:
- Log: features/wait/log.md
- Multi: features/wait/multi.md
- SQL: features/wait/sql.md
- Walk: features/wait/walk.md
- Modules:
- modules/index.md
- modules/artemis.md
Expand Down
Loading