Skip to content

Commit

Permalink
Merge pull request #3844 from yixingjia/addTest
Browse files Browse the repository at this point in the history
Add test case for Clair DB configuration
  • Loading branch information
yixingjia authored Dec 21, 2017
2 parents 01ec0c7 + 08a1b45 commit 7c510fa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ui/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/vmware/harbor/src/common/utils/test"
"github.com/vmware/harbor/src/common"
)

// test functions under package ui/config
Expand Down Expand Up @@ -118,9 +119,17 @@ func TestConfig(t *testing.T) {
t.Fatalf("failed to get database: %v", err)
}

if _, err := ClairDB(); err != nil {
clairDB, err := ClairDB();
if err != nil {
t.Fatalf("failed to get clair DB %v", err)
}
adminServerDefaultConfig := test.GetDefaultConfigMap()
assert.Equal(adminServerDefaultConfig[common.ClairDB],clairDB.Database)
assert.Equal(adminServerDefaultConfig[common.ClairDBUsername],clairDB.Username)
assert.Equal(adminServerDefaultConfig[common.ClairDBPassword],clairDB.Password)
assert.Equal(adminServerDefaultConfig[common.ClairDBHost], clairDB.Host)
assert.Equal(adminServerDefaultConfig[common.ClairDBPort], clairDB.Port)

if InternalNotaryEndpoint() != "http://notary-server:4443" {
t.Errorf("Unexpected notary endpoint: %s", InternalNotaryEndpoint())
}
Expand Down

0 comments on commit 7c510fa

Please sign in to comment.