Files
opencloud/vendor/github.com/testcontainers/testcontainers-go/wait/nop.go
dependabot[bot] d88bd1aa59 build(deps): bump github.com/testcontainers/testcontainers-go/modules/opensearch
Bumps [github.com/testcontainers/testcontainers-go/modules/opensearch](https://github.com/testcontainers/testcontainers-go) from 0.41.0 to 0.42.0.
- [Release notes](https://github.com/testcontainers/testcontainers-go/releases)
- [Commits](https://github.com/testcontainers/testcontainers-go/compare/v0.41.0...v0.42.0)

---
updated-dependencies:
- dependency-name: github.com/testcontainers/testcontainers-go/modules/opensearch
  dependency-version: 0.42.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-22 11:29:03 +02:00

90 lines
2.1 KiB
Go

package wait
import (
"context"
"io"
"time"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/testcontainers/testcontainers-go/exec"
)
var (
_ Strategy = (*NopStrategy)(nil)
_ StrategyTimeout = (*NopStrategy)(nil)
)
type NopStrategy struct {
timeout *time.Duration
waitUntilReady func(context.Context, StrategyTarget) error
}
func ForNop(
waitUntilReady func(context.Context, StrategyTarget) error,
) *NopStrategy {
return &NopStrategy{
waitUntilReady: waitUntilReady,
}
}
func (ws *NopStrategy) Timeout() *time.Duration {
return ws.timeout
}
// String returns a human-readable description of the wait strategy.
func (ws *NopStrategy) String() string {
return "custom wait condition"
}
func (ws *NopStrategy) WithStartupTimeout(timeout time.Duration) *NopStrategy {
ws.timeout = &timeout
return ws
}
func (ws *NopStrategy) WaitUntilReady(ctx context.Context, target StrategyTarget) error {
return ws.waitUntilReady(ctx, target)
}
type NopStrategyTarget struct {
ReaderCloser io.ReadCloser
ContainerState container.State
}
func (st NopStrategyTarget) Host(_ context.Context) (string, error) {
return "", nil
}
func (st NopStrategyTarget) Inspect(_ context.Context) (*container.InspectResponse, error) {
return nil, nil
}
// Deprecated: use Inspect instead
func (st NopStrategyTarget) Ports(_ context.Context) (network.PortMap, error) {
return nil, nil
}
func (st NopStrategyTarget) MappedPort(_ context.Context, n string) (network.Port, error) {
if n == "" {
return network.Port{}, nil
}
return network.ParsePort(n)
}
func (st NopStrategyTarget) Logs(_ context.Context) (io.ReadCloser, error) {
return st.ReaderCloser, nil
}
func (st NopStrategyTarget) Exec(_ context.Context, _ []string, _ ...exec.ProcessOption) (int, io.Reader, error) {
return 0, nil, nil
}
func (st NopStrategyTarget) State(_ context.Context) (*container.State, error) {
return &st.ContainerState, nil
}
func (st NopStrategyTarget) CopyFileFromContainer(context.Context, string) (io.ReadCloser, error) {
return st.ReaderCloser, nil
}