+func TestGetRtmDataNewSuccess(t *testing.T) {
+ expectedKubeCmd := []string{
+ `get configmap -o jsonpath='{.data.config-file\.json}' -n ricxapp configmap-ricxapp-dummy-xapp-appconfig`,
+ }
+ expectedMsgs := appmgr.RtmData{
+ TxMessages: []string{"RIC_X2_LOAD_INFORMATION"},
+ RxMessages: []string{"RIC_X2_LOAD_INFORMATION"},
+ Policies: []int64{11, 22, 33},
+ }
+
+ defer func() { resetKubeExecMock() }()
+ kubeExec = mockedKubeExec
+ //Fake 'kubectl get configmap' success
+ kubeExecRetOut = kubectlNewConfigmapOutput
+
+ result := NewCM().GetRtmData("dummy-xapp")
+ if !reflect.DeepEqual(result, expectedMsgs) {
+ t.Errorf("GetRtmData failed: expected: %v, got: %v", expectedMsgs, result)
+ }
+ if !reflect.DeepEqual(caughtKubeExecArgs, expectedKubeCmd) {
+ t.Errorf("GetRtmData failed: expected: '%v', got: '%v'", expectedKubeCmd, caughtKubeExecArgs)
+ }
+}
+