1
0
mirror of https://github.com/containrrr/watchtower.git synced 2025-06-30 23:23:50 +02:00
Files
watchtower/updater/updater_test.go
Brian DeHamer c02c4b9ec1 Handle container links
Ensures that linked containers are restarted if any of their
dependencies are restarted -- and makes sure that everything happens in
the correct order.
2015-07-15 22:22:00 +00:00

30 lines
708 B
Go

package updater
import (
"testing"
"github.com/CenturyLinkLabs/watchtower/docker"
"github.com/stretchr/testify/assert"
)
func TestCheckDependencies(t *testing.T) {
cs := []docker.Container{
docker.NewTestContainer("1", []string{}),
docker.NewTestContainer("2", []string{"1:"}),
docker.NewTestContainer("3", []string{"2:"}),
docker.NewTestContainer("4", []string{"3:"}),
docker.NewTestContainer("5", []string{"4:"}),
docker.NewTestContainer("6", []string{"5:"}),
}
cs[3].Stale = true
checkDependencies(cs)
assert.False(t, cs[0].Stale)
assert.False(t, cs[1].Stale)
assert.False(t, cs[2].Stale)
assert.True(t, cs[3].Stale)
assert.True(t, cs[4].Stale)
assert.True(t, cs[5].Stale)
}