mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-24 02:50:13 +01:00
Introduce test cases for proposed dependency sorting
This commit is contained in:
parent
348f121a61
commit
d65e6cd96c
4 changed files with 175 additions and 9 deletions
|
|
@ -8,7 +8,7 @@ import (
|
|||
)
|
||||
|
||||
// CreateMockContainer creates a container substitute valid for testing
|
||||
func CreateMockContainer(id string, name string, image string, created time.Time) container.Container {
|
||||
func CreateMockContainer(id string, name string, image string, created time.Time, depends []string) container.Container {
|
||||
content := types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
ID: id,
|
||||
|
|
@ -20,6 +20,15 @@ func CreateMockContainer(id string, name string, image string, created time.Time
|
|||
Labels: make(map[string]string),
|
||||
},
|
||||
}
|
||||
dependency_string := ""
|
||||
for ind, i := range depends {
|
||||
if ind == 0 {
|
||||
dependency_string += i;
|
||||
}else{
|
||||
dependency_string += "," + i;
|
||||
}
|
||||
}
|
||||
content.Config.Labels["com.centurylinklabs.watchtower.depends-on"] = dependency_string
|
||||
return *container.NewContainer(
|
||||
&content,
|
||||
&types.ImageInspect{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue