artifactory test

pull/77/head
Karolis Rusenas 2017-08-04 22:17:21 +01:00
parent a23d723840
commit 3a7e74bf1a
1 changed files with 27 additions and 3 deletions

View File

@ -3,9 +3,9 @@ package registry
import (
"github.com/rusenask/keel/constants"
"testing"
"fmt"
"os"
"testing"
)
func TestDigest(t *testing.T) {
@ -29,7 +29,6 @@ func TestDigest(t *testing.T) {
func TestGet(t *testing.T) {
client := New()
repo, err := client.Get(Opts{
// Registry: "https://index.docker.io",
Registry: constants.DefaultDockerRegistry,
Name: "karolisr/keel",
})
@ -41,3 +40,28 @@ func TestGet(t *testing.T) {
fmt.Println(repo.Name)
fmt.Println(repo.Tags)
}
var EnvArtifactoryUsername = "ARTIFACTORY_USERNAME"
var EnvArtifactoryPassword = "ARTIFACTORY_PASSWORD"
func TestGetArtifactory(t *testing.T) {
if os.Getenv(EnvArtifactoryUsername) == "" && os.Getenv(EnvArtifactoryPassword) == "" {
t.Skip()
}
client := New()
repo, err := client.Get(Opts{
Registry: "https://keel-docker-local.jfrog.io",
Name: "webhook-demo",
Username: os.Getenv(EnvArtifactoryUsername),
Password: os.Getenv(EnvArtifactoryPassword),
})
if err != nil {
t.Errorf("error while getting repo: %s", err)
}
fmt.Println(repo.Name)
fmt.Println(repo.Tags)
}