X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=cmd%2Fappmgr%2Fdesc_test.go;h=8f005a1be45e42755e4312a3a8155c12624bf711;hb=b6e413571bf3f44d4cd076815334449831d84e28;hp=bd4a3f3fe0c01de14f617cdff2e2702c999d62c8;hpb=d732b871ab1dccaf9ef5311dede522879193b45e;p=ric-plt%2Fappmgr.git diff --git a/cmd/appmgr/desc_test.go b/cmd/appmgr/desc_test.go index bd4a3f3..8f005a1 100755 --- a/cmd/appmgr/desc_test.go +++ b/cmd/appmgr/desc_test.go @@ -20,11 +20,11 @@ package main import ( - "testing" - "reflect" - "errors" "encoding/json" + "errors" "log" + "reflect" + "testing" ) var helmSearchOutput = ` @@ -59,8 +59,8 @@ var kubectlConfigmapOutput = ` ` type ConfigSample struct { - Level int - Host string + Level int + Host string } type MockedConfigMapper struct { @@ -74,7 +74,7 @@ func (cm *MockedConfigMapper) UploadConfig() (cfg []XAppConfig) { return } -func (cm *MockedConfigMapper) CreateConfigMap(r XAppConfig) (errList []CMError, err error){ +func (cm *MockedConfigMapper) CreateConfigMap(r XAppConfig) (errList []CMError, err error) { return } @@ -118,6 +118,10 @@ func (cm *MockedConfigMapper) GetNamespace(ns string) (n string) { return } +func (cm *MockedConfigMapper) GetNamesFromHelmRepo() (names []string) { + return +} + // Test cases func TestGetMessages(t *testing.T) { cm := ConfigMap{} @@ -130,7 +134,7 @@ func TestGetMessages(t *testing.T) { return []byte(kubectlConfigmapOutput), nil } - result := cm.GetMessages("dummy-xapp") + result := cm.GetMessages("dummy-xapp") if !reflect.DeepEqual(result, expectedMsgs) { t.Errorf("TestGetMessages failed: expected: %v, got: %v", expectedMsgs, result) } @@ -140,11 +144,11 @@ func TestHelmNamespace(t *testing.T) { cm := ConfigMap{} if cm.GetNamespace("pltxapp") != "pltxapp" { - t.Errorf("getNamespace failed!") + t.Errorf("getNamespace failed!") } - if cm.GetNamespace("") != "ricxapp" { - t.Errorf("getNamespace failed!") + if cm.GetNamespace("") != "default" { + t.Errorf("getNamespace failed!") } } @@ -315,4 +319,4 @@ func TestValidationFails(t *testing.T) { } log.Println("Feedbacks: ", feedback) -} \ No newline at end of file +}