refactor: move actions into pkg

pull/350/head^2
Simon Aronsson 5 years ago
parent 74ce92760c
commit 62f603bb25

@ -7,10 +7,10 @@ import (
"syscall"
"time"
"github.com/containrrr/watchtower/actions"
"github.com/containrrr/watchtower/pkg/container"
"github.com/containrrr/watchtower/internal/flags"
"github.com/containrrr/watchtower/notifications"
"github.com/containrrr/watchtower/pkg/actions"
"github.com/containrrr/watchtower/pkg/container"
t "github.com/containrrr/watchtower/pkg/types"
"github.com/robfig/cron"
log "github.com/sirupsen/logrus"

@ -5,7 +5,6 @@ import (
"testing"
"time"
"github.com/containrrr/watchtower/actions"
"github.com/containrrr/watchtower/pkg/container"
"github.com/containrrr/watchtower/pkg/container/mocks"
"github.com/docker/docker/api/types"
@ -44,7 +43,7 @@ var _ = Describe("the actions package", func() {
When("given an empty array", func() {
It("should not do anything", func() {
client.TestData.Containers = []container.Container{}
err := actions.CheckForMultipleWatchtowerInstances(client, false)
err := CheckForMultipleWatchtowerInstances(client, false)
Expect(err).NotTo(HaveOccurred())
})
})
@ -57,7 +56,7 @@ var _ = Describe("the actions package", func() {
"watchtower",
time.Now()),
}
err := actions.CheckForMultipleWatchtowerInstances(client, false)
err := CheckForMultipleWatchtowerInstances(client, false)
Expect(err).NotTo(HaveOccurred())
})
})
@ -85,7 +84,7 @@ var _ = Describe("the actions package", func() {
}
})
It("should stop all but the latest one", func() {
err := actions.CheckForMultipleWatchtowerInstances(client, false)
err := CheckForMultipleWatchtowerInstances(client, false)
Expect(err).NotTo(HaveOccurred())
})
})
@ -112,12 +111,12 @@ var _ = Describe("the actions package", func() {
}
})
It("should try to delete the image if the cleanup flag is true", func() {
err := actions.CheckForMultipleWatchtowerInstances(client, true)
err := CheckForMultipleWatchtowerInstances(client, true)
Expect(err).NotTo(HaveOccurred())
Expect(client.TestData.TriedToRemoveImage).To(BeTrue())
})
It("should not try to delete the image if the cleanup flag is false", func() {
err := actions.CheckForMultipleWatchtowerInstances(client, false)
err := CheckForMultipleWatchtowerInstances(client, false)
Expect(err).NotTo(HaveOccurred())
Expect(client.TestData.TriedToRemoveImage).To(BeFalse())
})
Loading…
Cancel
Save