mirror of
https://github.com/containrrr/watchtower.git
synced 2026-03-09 14:12:36 +01:00
pkg/registry: improve logging, tests & (test) readability
This commit is contained in:
parent
905a38f24c
commit
6d64f81ad4
8 changed files with 90 additions and 76 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/docker/distribution/reference"
|
||||
)
|
||||
|
||||
// domains for Docker Hub, the default registry
|
||||
const (
|
||||
DefaultRegistryDomain = "docker.io"
|
||||
DefaultRegistryHost = "index.docker.io"
|
||||
|
|
|
|||
|
|
@ -18,15 +18,19 @@ var _ = Describe("the helpers", func() {
|
|||
_, err := GetRegistryAddress("")
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
It("should return index.docker.io if passed an image name with no explicit domain", func() {
|
||||
It("should return index.docker.io for image refs with no explicit registry", func() {
|
||||
Expect(GetRegistryAddress("watchtower")).To(Equal("index.docker.io"))
|
||||
Expect(GetRegistryAddress("containrrr/watchtower")).To(Equal("index.docker.io"))
|
||||
})
|
||||
It("should return index.docker.io for image refs with docker.io domain", func() {
|
||||
Expect(GetRegistryAddress("docker.io/watchtower")).To(Equal("index.docker.io"))
|
||||
Expect(GetRegistryAddress("docker.io/containrrr/watchtower")).To(Equal("index.docker.io"))
|
||||
})
|
||||
It("should return the host if passed an image name containing a local host", func() {
|
||||
Expect(GetRegistryAddress("henk:80/watchtower")).To(Equal("henk:80"))
|
||||
Expect(GetRegistryAddress("localhost/watchtower")).To(Equal("localhost"))
|
||||
})
|
||||
It("should return the server name if passed a fully qualified image name", func() {
|
||||
It("should return the server address if passed a fully qualified image name", func() {
|
||||
Expect(GetRegistryAddress("github.com/containrrr/config")).To(Equal("github.com"))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue