testcontainers / testcontainers/testcontainers-go
[Enhancement]: Simpler API for Docker compose UP & DOWN
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Go
- Stars
- 5k
- Forks
- 637
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 26
Description
Proposal
Proposal
- Add a simpler wrapper API to start & shut down Docker Compose.
servicesToPrintLogsFor := []string{"service-1"}
waitStrategies := map[string]wait.Strategy{
"service-1": wait.NewLogStrategy(" ... ...").WithStartupTimeout(60 * time.Second).WithPollInterval(1 * time.Millisecond),
"service-2": wait.NewLogStrategy("... ...").WithStartupTimeout(60 * time.Second).WithPollInterval(1 * time.Millisecond),
}
dockerComposeDown, e := tc.DockerComposeUp(dockerComposeFilePath, waitStrategies)
defer dockerComposeDown(servicesToPrintLogsFor)
if e != nil {
return fmt.Errorf("error when attempting to setup & run compose stack: %w", e)
}
Why?
- There are many users who for the most simplest of testing needs require only a simple API to start & shut down their docker compose as part of their test setup & teardown.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing Docker Compose lifecycle API and its wait.Strategy support. Compare the proposed DockerComposeUp wrapper with the example's test setup and teardown flow. Done means a simpler API can start the compose stack, apply the supplied wait strategies, and provide shutdown with optional service log output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker-compose, go
- Domain
- devops, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100