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 43b9bc9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dockertestx/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ func New(opt PoolOption) (*Pool, error) {
_ = json.NewDecoder(opt.StateStore).Decode(&ds)
for _, s := range ds {
r, ok := pool.ContainerByName(s.ContainerName)
if !ok || !r.Container.State.Running {
// ignore not found or stopped container
if !ok {
continue
}
if !r.Container.State.Running {
err := pool.Purge(r)
if err != nil {
panic(err)
}
continue
}
s.r = r
Expand Down

0 comments on commit 43b9bc9

Please sign in to comment.