X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fut_messaging_test.go;h=81464b8cb68c8cc93ef177c0c19fc550ac64f5a6;hb=47518ae7612cbfb1562fa1f74b9023389d8cfd61;hp=f3b8b8e572f33355172f33d0c6034f07a4a990e7;hpb=ebaeae67034fe1168d6014bd5c1739d4e09923c0;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index f3b8b8e..81464b8 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -129,7 +129,7 @@ func TestSubReqAndRouteUpdateNok(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) waiter := rtmgrHttp.AllocNextEvent(false) newSubsId := mainCtrl.get_registry_next_subid(t) @@ -205,7 +205,7 @@ func TestSubDelReqAndRouteDeleteNok(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) @@ -310,7 +310,7 @@ func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) //Del1 waiter := rtmgrHttp.AllocNextEvent(false) @@ -394,7 +394,7 @@ func TestSubReqAndSubDelOk(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) @@ -1309,7 +1309,7 @@ func TestSubReqAndSubDelOkSameAction(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) //Del1 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) @@ -1936,7 +1936,7 @@ func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) e2SubsId := uint32(resp[0].SubscriptionID) t.Logf("e2SubsId = %v", e2SubsId) @@ -2003,7 +2003,7 @@ func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) mainCtrl.SimulateRestart(t) @@ -2011,7 +2011,7 @@ func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { resp, _ = xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) @@ -2104,7 +2104,7 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) mainCtrl.SimulateRestart(t) @@ -2112,7 +2112,7 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { resp, _ = xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") - assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) + assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) //Del1 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) @@ -2138,3 +2138,37 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) } + +//----------------------------------------------------------------------------- +// Test debug GET and POST requests +// +// curl +// +-------+ +---------+ +// | user | | submgr | +// +-------+ +---------+ +// | | +// | GET/POST Req | +// |------------->| +// | Resp | +// |<-------------| +// | | + +func TestGetSubscriptions(t *testing.T) { + + mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") +} + +func TestGetSymptomData(t *testing.T) { + + mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") +} + +func TestPostdeleteSubId(t *testing.T) { + + mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") +} + +func TestPostEmptyDb(t *testing.T) { + + mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") +}