mirror of
https://github.com/containrrr/watchtower.git
synced 2026-03-08 05:32:35 +01:00
Consolidated all post-fork updates including dependency bumps and workflow changes
This commit is contained in:
parent
2abaa47fd3
commit
6b62d53797
100 changed files with 1503 additions and 1264 deletions
|
|
@ -1,7 +1,8 @@
|
|||
package container
|
||||
|
||||
import (
|
||||
"github.com/containrrr/watchtower/pkg/types"
|
||||
"github.com/nicholas-fedor/watchtower/pkg/types"
|
||||
dc "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/go-connections/nat"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
|
@ -67,6 +68,93 @@ var _ = Describe("the container", func() {
|
|||
})
|
||||
})
|
||||
})
|
||||
Describe("GetCreateConfig", func() {
|
||||
When("container healthcheck config is equal to image config", func() {
|
||||
It("should return empty healthcheck values", func() {
|
||||
c := MockContainer(WithHealthcheck(dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "1s"},
|
||||
}), WithImageHealthcheck(dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "1s"},
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{}))
|
||||
|
||||
c = MockContainer(WithHealthcheck(dc.HealthConfig{
|
||||
Timeout: 30,
|
||||
}), WithImageHealthcheck(dc.HealthConfig{
|
||||
Timeout: 30,
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{}))
|
||||
|
||||
c = MockContainer(WithHealthcheck(dc.HealthConfig{
|
||||
StartPeriod: 30,
|
||||
}), WithImageHealthcheck(dc.HealthConfig{
|
||||
StartPeriod: 30,
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{}))
|
||||
|
||||
c = MockContainer(WithHealthcheck(dc.HealthConfig{
|
||||
Retries: 30,
|
||||
}), WithImageHealthcheck(dc.HealthConfig{
|
||||
Retries: 30,
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{}))
|
||||
})
|
||||
})
|
||||
When("container healthcheck config is different to image config", func() {
|
||||
It("should return the container healthcheck values", func() {
|
||||
c := MockContainer(WithHealthcheck(dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "1s"},
|
||||
Interval: 30,
|
||||
Timeout: 30,
|
||||
StartPeriod: 10,
|
||||
Retries: 2,
|
||||
}), WithImageHealthcheck(dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "10s"},
|
||||
Interval: 10,
|
||||
Timeout: 60,
|
||||
StartPeriod: 30,
|
||||
Retries: 10,
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "1s"},
|
||||
Interval: 30,
|
||||
Timeout: 30,
|
||||
StartPeriod: 10,
|
||||
Retries: 2,
|
||||
}))
|
||||
})
|
||||
})
|
||||
When("container healthcheck config is empty", func() {
|
||||
It("should not panic", func() {
|
||||
c := MockContainer(WithImageHealthcheck(dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "10s"},
|
||||
Interval: 10,
|
||||
Timeout: 60,
|
||||
StartPeriod: 30,
|
||||
Retries: 10,
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(BeNil())
|
||||
})
|
||||
})
|
||||
When("container image healthcheck config is empty", func() {
|
||||
It("should not panic", func() {
|
||||
c := MockContainer(WithHealthcheck(dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "1s"},
|
||||
Interval: 30,
|
||||
Timeout: 30,
|
||||
StartPeriod: 10,
|
||||
Retries: 2,
|
||||
}))
|
||||
Expect(c.GetCreateConfig().Healthcheck).To(Equal(&dc.HealthConfig{
|
||||
Test: []string{"/usr/bin/sleep", "1s"},
|
||||
Interval: 30,
|
||||
Timeout: 30,
|
||||
StartPeriod: 10,
|
||||
Retries: 2,
|
||||
}))
|
||||
})
|
||||
})
|
||||
})
|
||||
When("asked for metadata", func() {
|
||||
var c *Container
|
||||
BeforeEach(func() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue