Skip to content

Commit

Permalink
fix(dockertestx): Remove stopped container
Browse files Browse the repository at this point in the history
  • Loading branch information
rxnew committed Feb 18, 2024
1 parent 4d2f015 commit 456dce3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dockertestx/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"os"

"github.com/ory/dockertest/v3/docker"

"github.com/ory/dockertest/v3"

"github.com/tier4/x-go/idx"
Expand Down Expand Up @@ -58,6 +60,7 @@ func New(opt PoolOption) (*Pool, error) {
r, ok := pool.ContainerByName(s.ContainerName)
if !ok || !r.Container.State.Running {
// ignore not found or stopped container
_ = pool.Client.RemoveContainer(docker.RemoveContainerOptions{ID: r.Container.ID, RemoveVolumes: true, Force: true})
continue
}
s.r = r
Expand Down

0 comments on commit 456dce3

Please sign in to comment.