From 68f39777654f71f53424c348d8cdc7d105278436 Mon Sep 17 00:00:00 2001 From: Ivan Ilves Date: Sat, 7 Apr 2018 15:35:07 +0200 Subject: [PATCH] KAIZEN: Improve `api/v1` coverage --- api/v1/v1_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/api/v1/v1_test.go b/api/v1/v1_test.go index 78afb96..21cf282 100644 --- a/api/v1/v1_test.go +++ b/api/v1/v1_test.go @@ -2,11 +2,13 @@ package v1 import ( "fmt" + log "github.com/sirupsen/logrus" "testing" "github.com/stretchr/testify/assert" "github.com/ivanilves/lstags/api/registry" + "github.com/ivanilves/lstags/repository" ) func runEnd2EndJob(pullRefs, seedRefs []string) ([]string, error) { @@ -128,3 +130,31 @@ func TestEnd2End(t *testing.T) { assert.Equal(testCase.expectedPushRefs, pushRefs, fmt.Sprintf("%+v", testCase)) } } + +func TestNew_VerboseLogging(t *testing.T) { + assert := assert.New(t) + + New(Config{VerboseLogging: true}) + + assert.Equal(log.DebugLevel, log.GetLevel()) +} + +func TestNew_InsecureRegistryEx(t *testing.T) { + const ex = ".*" + + assert := assert.New(t) + + New(Config{InsecureRegistryEx: ex}) + + assert.Equal(ex, repository.InsecureRegistryEx) +} + +func TestNew_InvalidDockerJSONConfigFile(t *testing.T) { + assert := assert.New(t) + + api, err := New(Config{DockerJSONConfigFile: "/i/do/not/exist/sorry"}) + + assert.Nil(api) + + assert.NotNil(err) +}