mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-20 17:10:13 +01:00
add some more tests and debug logs
This commit is contained in:
parent
2b68874087
commit
0c704ce02b
9 changed files with 727 additions and 39 deletions
|
|
@ -4,21 +4,21 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"github.com/containrrr/watchtower/pkg/logger"
|
||||
"github.com/containrrr/watchtower/pkg/registry/auth"
|
||||
wtTypes "github.com/containrrr/watchtower/pkg/types"
|
||||
"github.com/docker/docker/api/types"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing with Ginkgo", func() {
|
||||
It("digest", func() {
|
||||
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(GinkgoT(), "Digest Suite")
|
||||
})
|
||||
})
|
||||
|
||||
func TestDigest(t *testing.T) {
|
||||
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(GinkgoT(), "Digest Suite")
|
||||
}
|
||||
|
||||
var ghImage = types.ImageInspect{
|
||||
ID: "sha256:6972c414f322dfa40324df3c503d4b217ccdec6d576e408ed10437f508f4181b",
|
||||
|
|
@ -56,16 +56,6 @@ func SkipIfCredentialsEmpty(credentials *wtTypes.RegistryCredentials, fn func())
|
|||
var _ = Describe("Digests", func() {
|
||||
var ctx = logger.AddDebugLogger(context.Background())
|
||||
|
||||
When("fetching a bearer token", func() {
|
||||
|
||||
It("should parse the token from the response",
|
||||
SkipIfCredentialsEmpty(GHCRCredentials, func() {
|
||||
token, err := auth.GetToken(ctx, ghImage, GHCRCredentials)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(token).NotTo(Equal(""))
|
||||
}),
|
||||
)
|
||||
})
|
||||
When("a digest comparison is done", func() {
|
||||
It("should return true if digests match",
|
||||
SkipIfCredentialsEmpty(GHCRCredentials, func() {
|
||||
|
|
@ -83,9 +73,11 @@ var _ = Describe("Digests", func() {
|
|||
})
|
||||
})
|
||||
When("using different registries", func() {
|
||||
It("should work with DockerHub", func() {
|
||||
|
||||
})
|
||||
It("should work with DockerHub",
|
||||
SkipIfCredentialsEmpty(DockerHubCredentials, func() {
|
||||
fmt.Println(DockerHubCredentials != nil) // to avoid crying linters
|
||||
}),
|
||||
)
|
||||
It("should work with GitHub Container Registry",
|
||||
SkipIfCredentialsEmpty(GHCRCredentials, func() {
|
||||
fmt.Println(GHCRCredentials != nil) // to avoid crying linters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue