forked from testcontainers/testcontainers-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into context-support
* main: fix: container binds syntax (testcontainers#2899) refactor(cockroachdb): to use request driven options (testcontainers#2883) chore(deps): bump actions/setup-go from 5.0.0 to 5.1.0 (testcontainers#2904) chore(deps): bump ossf/scorecard-action from 2.3.1 to 2.4.0 (testcontainers#2903) chore(deps): bump test-summary/action from 2.3 to 2.4 (testcontainers#2902) feat(wait): strategy walk (testcontainers#2895) feat(wait): tls strategy (testcontainers#2896)
- Loading branch information
Showing
35 changed files
with
1,121 additions
and
520 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
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,31 @@ | ||
# TLS Strategy | ||
|
||
TLS Strategy waits for one or more files to exist in the container and uses them | ||
and other details to construct a `tls.Config` which can be used to create secure | ||
connections. | ||
|
||
It supports: | ||
|
||
- x509 PEM Certificate loaded from a certificate / key file pair. | ||
- Root Certificate Authorities aka RootCAs loaded from PEM encoded files. | ||
- Server name. | ||
- Startup timeout to be used in seconds, default is 60 seconds. | ||
- Poll interval to be used in milliseconds, default is 100 milliseconds. | ||
|
||
## Waiting for certificate pair | ||
|
||
The following snippets show how to configure a request to wait for certificate | ||
pair to exist once started and then read the | ||
[tls.Config](https://pkg.go.dev/crypto/tls#Config), alongside how to copy a test | ||
certificate pair into a container image using a `Dockerfile`. | ||
|
||
It should be noted that copying certificate pairs into an images is only an | ||
example which might be useful for testing with testcontainers-go and should not | ||
be done with production images as that could expose your certificates if your | ||
images become public. | ||
|
||
<!--codeinclude--> | ||
[Wait for certificate](../../../wait/tls_test.go) inside_block:waitForTLSCert | ||
[Read TLS Config](../../../wait/tls_test.go) inside_block:waitTLSConfig | ||
[Dockerfile with certificate](../../../wait/testdata/http/Dockerfile) | ||
<!--/codeinclude--> |
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,19 @@ | ||
# Walk | ||
|
||
Walk walks the strategies tree and calls the visit function for each node. | ||
|
||
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. | ||
|
||
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--> | ||
[Remove FileStrategy entries](../../../wait/walk_test.go) inside_block:walkRemoveFileStrategy | ||
<!--/codeinclude--> |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.