mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 23:20:12 +01:00
test alias purging
This commit is contained in:
parent
48e689fa8f
commit
fed77746f6
1 changed files with 19 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package container
|
package container
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/docker/docker/api/types/network"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containrrr/watchtower/internal/util"
|
"github.com/containrrr/watchtower/internal/util"
|
||||||
|
|
@ -284,6 +285,24 @@ var _ = Describe("the client", func() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Describe(`GetNetworkConfig`, func() {
|
||||||
|
When(`providing a container with network aliases`, func() {
|
||||||
|
It(`should purge the aliases`, func() {
|
||||||
|
aliases := []string{"One", "Two"}
|
||||||
|
client := dockerClient{
|
||||||
|
api: docker,
|
||||||
|
ClientOptions: ClientOptions{PullImages: false, IncludeRestarting: false},
|
||||||
|
}
|
||||||
|
container := MockContainer(WithImageName("docker.io/prefix/imagename:latest"))
|
||||||
|
endpoints := map[string]*network.EndpointSettings{
|
||||||
|
`test`: {Aliases: aliases},
|
||||||
|
}
|
||||||
|
container.containerInfo.NetworkSettings = &types.NetworkSettings{Networks: endpoints}
|
||||||
|
Expect(container.ContainerInfo().NetworkSettings.Networks[`test`].Aliases).To(Equal(aliases))
|
||||||
|
Expect(client.GetNetworkConfig(container).EndpointsConfig[`test`].Aliases).To(BeEmpty())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Capture logrus output in buffer
|
// Capture logrus output in buffer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue