Skip to content

Commit

Permalink
test alias purging
Browse files Browse the repository at this point in the history
  • Loading branch information
simskij committed Jul 26, 2023
1 parent 48e689f commit fed7774
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/container/client_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"github.com/docker/docker/api/types/network"
"time"

"github.com/containrrr/watchtower/internal/util"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fed7774

Please sign in to comment.