mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-15 14:40:13 +01:00
Allow user-configurable DOCKER_HOST
This commit is contained in:
parent
00f2875abf
commit
4ba21639a0
10 changed files with 202 additions and 35 deletions
|
|
@ -32,12 +32,12 @@ func TestByCreated(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSortByDependencies_Success(t *testing.T) {
|
||||
c1 := NewTestContainer("1", []string{})
|
||||
c2 := NewTestContainer("2", []string{"1:"})
|
||||
c3 := NewTestContainer("3", []string{"2:"})
|
||||
c4 := NewTestContainer("4", []string{"3:"})
|
||||
c5 := NewTestContainer("5", []string{"4:"})
|
||||
c6 := NewTestContainer("6", []string{"5:", "3:"})
|
||||
c1 := newTestContainer("1", []string{})
|
||||
c2 := newTestContainer("2", []string{"1:"})
|
||||
c3 := newTestContainer("3", []string{"2:"})
|
||||
c4 := newTestContainer("4", []string{"3:"})
|
||||
c5 := newTestContainer("5", []string{"4:"})
|
||||
c6 := newTestContainer("6", []string{"5:", "3:"})
|
||||
containers := []Container{c6, c2, c4, c1, c3, c5}
|
||||
|
||||
result, err := SortByDependencies(containers)
|
||||
|
|
@ -47,9 +47,9 @@ func TestSortByDependencies_Success(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSortByDependencies_Error(t *testing.T) {
|
||||
c1 := NewTestContainer("1", []string{"3:"})
|
||||
c2 := NewTestContainer("2", []string{"1:"})
|
||||
c3 := NewTestContainer("3", []string{"2:"})
|
||||
c1 := newTestContainer("1", []string{"3:"})
|
||||
c2 := newTestContainer("2", []string{"1:"})
|
||||
c3 := newTestContainer("3", []string{"2:"})
|
||||
containers := []Container{c1, c2, c3}
|
||||
|
||||
_, err := SortByDependencies(containers)
|
||||
|
|
@ -57,3 +57,15 @@ func TestSortByDependencies_Error(t *testing.T) {
|
|||
assert.Error(t, err)
|
||||
assert.EqualError(t, err, "Circular reference to 1")
|
||||
}
|
||||
|
||||
func newTestContainer(name string, links []string) Container {
|
||||
return *NewContainer(
|
||||
&dockerclient.ContainerInfo{
|
||||
Name: name,
|
||||
HostConfig: &dockerclient.HostConfig{
|
||||
Links: links,
|
||||
},
|
||||
},
|
||||
nil,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue