X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fxapp%2Fxapp_test.go;h=e36d1cb8df006ce88c214607af162aa09171ea98;hb=refs%2Ftags%2Fad0a271;hp=27fb44514c67ead3340685f9df5445e1d9af8339;hpb=3cfee96f252fa5d63bb8062f8ade1e9697103a7b;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/xapp_test.go b/pkg/xapp/xapp_test.go index 27fb445..e36d1cb 100755 --- a/pkg/xapp/xapp_test.go +++ b/pkg/xapp/xapp_test.go @@ -102,6 +102,7 @@ func TestInjectQueryFailures(t *testing.T) { } func TestMessagesReceivedSuccessfully(t *testing.T) { + time.Sleep(time.Duration(5) * time.Second) for i := 0; i < 100; i++ { params := &RMRParams{} params.Mtype = 10004 @@ -118,11 +119,11 @@ func TestMessagesReceivedSuccessfully(t *testing.T) { waitForSdl := viper.GetBool("db.waitForSdl") stats := getMetrics(t) if !strings.Contains(stats, "ricxapp_RMR_Transmitted 100") { - t.Errorf("Error: ricxapp_RMR_Transmitted value incorrect") + t.Errorf("Error: ricxapp_RMR_Transmitted value incorrect: %v", stats) } if !strings.Contains(stats, "ricxapp_RMR_Received 100") { - t.Errorf("Error: ricxapp_RMR_Received value incorrect") + t.Errorf("Error: ricxapp_RMR_Received value incorrect: %v", stats) } if !strings.Contains(stats, "ricxapp_RMR_TransmitError 0") { @@ -142,6 +143,52 @@ func TestMessagesReceivedSuccessfully(t *testing.T) { } } +func TestMessagesReceivedSuccessfullyUsingWh(t *testing.T) { + time.Sleep(time.Duration(5) * time.Second) + whid := Rmr.Openwh("localhost:4560") + time.Sleep(time.Duration(1) * time.Second) + for i := 0; i < 100; i++ { + params := &RMRParams{} + params.Mtype = 10004 + params.SubId = -1 + params.Payload = []byte{1, 2, 3, 4, 5, 6} + params.Meid = &RMRMeid{PlmnID: "1234", EnbID: "7788", RanName: "RanName-1234"} + params.Xid = "TestXID" + params.Whid = int(whid) + Rmr.SendMsg(params) + } + + // Allow time to process the messages + time.Sleep(time.Duration(2) * time.Second) + + waitForSdl := viper.GetBool("db.waitForSdl") + stats := getMetrics(t) + if !strings.Contains(stats, "ricxapp_RMR_Transmitted 200") { + t.Errorf("Error: ricxapp_RMR_Transmitted value incorrect: %v", stats) + } + + if !strings.Contains(stats, "ricxapp_RMR_Received 200") { + t.Errorf("Error: ricxapp_RMR_Received value incorrect: %v", stats) + } + + if !strings.Contains(stats, "ricxapp_RMR_TransmitError 0") { + t.Errorf("Error: ricxapp_RMR_TransmitError value incorrect") + } + + if !strings.Contains(stats, "ricxapp_RMR_ReceiveError 0") { + t.Errorf("Error: ricxapp_RMR_ReceiveError value incorrect") + } + + if waitForSdl && !strings.Contains(stats, "ricxapp_SDL_Stored 200") { + t.Errorf("Error: ricxapp_SDL_Stored value incorrect") + } + + if waitForSdl && !strings.Contains(stats, "ricxapp_SDL_StoreError 0") { + t.Errorf("Error: ricxapp_SDL_StoreError value incorrect") + } + Rmr.Closewh(int(whid)) +} + func TestSubscribeChannels(t *testing.T) { if !viper.GetBool("db.waitForSdl") { return