mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
Merge pull request #3844 from yixingjia/addTest
Add test case for Clair DB configuration
This commit is contained in:
commit
7c510fa2c8
@ -19,6 +19,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/vmware/harbor/src/common/utils/test"
|
"github.com/vmware/harbor/src/common/utils/test"
|
||||||
|
"github.com/vmware/harbor/src/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// test functions under package ui/config
|
// test functions under package ui/config
|
||||||
@ -118,9 +119,17 @@ func TestConfig(t *testing.T) {
|
|||||||
t.Fatalf("failed to get database: %v", err)
|
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)
|
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" {
|
if InternalNotaryEndpoint() != "http://notary-server:4443" {
|
||||||
t.Errorf("Unexpected notary endpoint: %s", InternalNotaryEndpoint())
|
t.Errorf("Unexpected notary endpoint: %s", InternalNotaryEndpoint())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user