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): tls strategy #2896

Merged
merged 5 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
1 change: 1 addition & 0 deletions docs/features/wait/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Below you can find a list of the available wait strategies that you can use:
- [Log](./log.md)
- [Multi](./multi.md)
- [SQL](./sql.md)
- [TLS](./tls.md)
stevenh marked this conversation as resolved.
Show resolved Hide resolved

## Startup timeout and Poll interval

Expand Down
15 changes: 13 additions & 2 deletions docs/features/wait/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@ It supports:
- 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 to exist and construct a tls.Config
## 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 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.

<!--codeinclude-->
[Waiting for certificate pair to exist and construct a tls.Config](../../../wait/tls_test.go) inside_block:waitForTLSCert
[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-->
2 changes: 2 additions & 0 deletions wait/tls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ func ExampleForTLSCert() {

fmt.Println(state.Running)

// waitTLSConfig {
config := forCert.TLSConfig()
// }
fmt.Println(config.ServerName)
fmt.Println(len(config.Certificates))

Expand Down
Loading