Skip to content

Commit

Permalink
fix cleanup for rolling updates (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
piksel committed Dec 20, 2020
1 parent ea16683 commit 4d17cf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/actions/update.go
Expand Up @@ -73,6 +73,7 @@ func performRollingRestart(containers []container.Container, client container.Cl
if containers[i].Stale {
stopStaleContainer(containers[i], client, params)
restartStaleContainer(containers[i], client, params)
cleanupImageIDs[containers[i].ImageID()] = true
}
}

Expand Down
8 changes: 8 additions & 0 deletions internal/actions/update_test.go
Expand Up @@ -80,6 +80,14 @@ var _ = Describe("the update action", func() {
Expect(client.TestData.TriedToRemoveImageCount).To(Equal(2))
})
})
When("performing a rolling restart update", func() {
It("should try to remove the image once", func() {

err := actions.Update(client, types.UpdateParams{Cleanup: true, RollingRestart: true})
Expect(err).NotTo(HaveOccurred())
Expect(client.TestData.TriedToRemoveImageCount).To(Equal(1))
})
})
})

When("watchtower has been instructed to monitor only", func() {
Expand Down

0 comments on commit 4d17cf1

Please sign in to comment.