|
|
|
@ -70,7 +70,8 @@ var _ = Describe("the client", func() {
|
|
|
|
|
It("should gracefully fail with a useful message", func() {
|
|
|
|
|
c := dockerClient{}
|
|
|
|
|
pinnedContainer := MockContainer(WithImageName("sha256:fa5269854a5e615e51a72b17ad3fd1e01268f278a6684c8ed3c5f0cdce3f230b"))
|
|
|
|
|
c.PullImage(context.Background(), pinnedContainer)
|
|
|
|
|
err := c.PullImage(context.Background(), pinnedContainer)
|
|
|
|
|
Expect(err).To(MatchError(`container uses a pinned image, and cannot be updated by watchtower`))
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
@ -144,7 +145,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&mocks.Watchtower, &mocks.Running)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false},
|
|
|
|
|
ClientOptions: ClientOptions{},
|
|
|
|
|
}
|
|
|
|
|
containers, err := client.ListContainers(filters.NoFilter)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -158,7 +159,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
filter := filters.FilterByNames([]string{"lollercoaster"}, filters.NoFilter)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false},
|
|
|
|
|
ClientOptions: ClientOptions{},
|
|
|
|
|
}
|
|
|
|
|
containers, err := client.ListContainers(filter)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -171,7 +172,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&mocks.Watchtower, &mocks.Running)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false},
|
|
|
|
|
ClientOptions: ClientOptions{},
|
|
|
|
|
}
|
|
|
|
|
containers, err := client.ListContainers(filters.WatchtowerContainersFilter)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -184,7 +185,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&mocks.Stopped, &mocks.Watchtower, &mocks.Running)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false, IncludeStopped: true},
|
|
|
|
|
ClientOptions: ClientOptions{IncludeStopped: true},
|
|
|
|
|
}
|
|
|
|
|
containers, err := client.ListContainers(filters.NoFilter)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -197,7 +198,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&mocks.Watchtower, &mocks.Running, &mocks.Restarting)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false, IncludeRestarting: true},
|
|
|
|
|
ClientOptions: ClientOptions{IncludeRestarting: true},
|
|
|
|
|
}
|
|
|
|
|
containers, err := client.ListContainers(filters.NoFilter)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -210,7 +211,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&mocks.Watchtower, &mocks.Running)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false, IncludeRestarting: false},
|
|
|
|
|
ClientOptions: ClientOptions{IncludeRestarting: false},
|
|
|
|
|
}
|
|
|
|
|
containers, err := client.ListContainers(filters.NoFilter)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -224,7 +225,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&consumerContainerRef)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false},
|
|
|
|
|
ClientOptions: ClientOptions{},
|
|
|
|
|
}
|
|
|
|
|
container, err := client.GetContainer(consumerContainerRef.ContainerID())
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -238,7 +239,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
mockServer.AppendHandlers(mocks.GetContainerHandlers(&consumerContainerRef)...)
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false},
|
|
|
|
|
ClientOptions: ClientOptions{},
|
|
|
|
|
}
|
|
|
|
|
container, err := client.GetContainer(consumerContainerRef.ContainerID())
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
@ -253,7 +254,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
It("should include container id field", func() {
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false},
|
|
|
|
|
ClientOptions: ClientOptions{},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Capture logrus output in buffer
|
|
|
|
@ -320,7 +321,7 @@ var _ = Describe("the client", func() {
|
|
|
|
|
It(`should omit the container ID alias`, func() {
|
|
|
|
|
client := dockerClient{
|
|
|
|
|
api: docker,
|
|
|
|
|
ClientOptions: ClientOptions{PullImages: false, IncludeRestarting: false},
|
|
|
|
|
ClientOptions: ClientOptions{IncludeRestarting: false},
|
|
|
|
|
}
|
|
|
|
|
container := MockContainer(WithImageName("docker.io/prefix/imagename:latest"))
|
|
|
|
|
|
|
|
|
|