Adding UT framework
Change-Id: I77fd96893b49735daefcc24f4b1c70e8228d769e
Signed-off-by: dhirajverma <dhiraj.verma@nokia.com>
diff --git a/RIC-E2-TERMINATION/sctpThread.cpp b/RIC-E2-TERMINATION/sctpThread.cpp
index 16430fe..651edd9 100644
--- a/RIC-E2-TERMINATION/sctpThread.cpp
+++ b/RIC-E2-TERMINATION/sctpThread.cpp
@@ -313,7 +313,7 @@
sctpParams.prometheusExposer = new Exposer(prometheusPath, 1);
sctpParams.prometheusExposer->RegisterCollectable(sctpParams.prometheusRegistry);
}
-
+#ifndef UNIT_TEST
int main(const int argc, char **argv) {
sctp_params_t sctpParams;
@@ -417,7 +417,7 @@
return 0;
}
-
+#endif
void handleTermInit(sctp_params_t &sctpParams) {
sendTermInit(sctpParams);
//send to e2 manager init of e2 term
@@ -853,6 +853,7 @@
socklen_t retValLen = 0;
auto rc = getsockopt(peerInfo->fileDescriptor, SOL_SOCKET, SO_ERROR, &retVal, &retValLen);
if (rc != 0 || retVal != 0) {
+#ifndef UNIT_TEST
if (rc != 0) {
rmrMessageBuffer.sendMessage->len = snprintf((char *)rmrMessageBuffer.sendMessage->payload, 256,
"%s|Failed SCTP Connection, after EINPROGRESS the getsockopt%s",
@@ -870,6 +871,7 @@
if (sendRequestToXapp(message, RIC_SCTP_CONNECTION_FAILURE, rmrMessageBuffer) != 0) {
mdclog_write(MDCLOG_ERR, "SCTP_CONNECTION_FAIL message failed to send to xAPP");
}
+#endif
memset(peerInfo->asnData, 0, peerInfo->asnLength);
peerInfo->asnLength = 0;
peerInfo->mtype = 0;
@@ -914,6 +916,7 @@
auto *peerInfo = (ConnectedCU_t *)event.data.ptr;
mdclog_write(MDCLOG_ERR, "epoll error, events %0x on fd %d, RAN NAME : %s",
event.events, peerInfo->fileDescriptor, peerInfo->enodbName);
+#ifndef UNIT_TEST
rmrMessageBuffer.sendMessage->len = snprintf((char *)rmrMessageBuffer.sendMessage->payload, 256,
"%s|Failed SCTP Connection",
@@ -926,7 +929,7 @@
if (sendRequestToXapp(message, RIC_SCTP_CONNECTION_FAILURE, rmrMessageBuffer) != 0) {
mdclog_write(MDCLOG_ERR, "SCTP_CONNECTION_FAIL message failed to send to xAPP");
}
-
+#endif
close(peerInfo->fileDescriptor);
params->sctpMap->erase(peerInfo->enodbName);
cleanHashEntry((ConnectedCU_t *) event.data.ptr, params->sctpMap);
@@ -974,7 +977,9 @@
m->erase(searchBuff);
m->erase(val->enodbName);
+#ifndef UNIT_TEST
free(val);
+#endif
}
/**
@@ -2646,5 +2651,3 @@
}
return str;
}
-
-