[RIC-621] - Fix Automation
[ric-plt/e2mgr.git] / E2Manager / managers / ran_connect_status_change_manager_test.go
index b9295e3..53921a1 100644 (file)
@@ -38,7 +38,11 @@ func initRanConnectStatusChangeManagerTest(t *testing.T) (*mocks.RnibWriterMock,
        if err != nil {
                t.Errorf("#... - failed to initialize log, error: %s", err)
        }
-       config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3, StateChangeMessageChannel: EventChannelForTest}
+       config := &configuration.Configuration{RnibRetryIntervalMs: 10, MaxRnibConnectionAttempts: 3,
+               RnibWriter: configuration.RnibWriterConfig{
+                       StateChangeMessageChannel: EventChannelForTest,
+               },
+       }
 
        readerMock := &mocks.RnibReaderMock{}
        writerMock := &mocks.RnibWriterMock{}
@@ -55,7 +59,7 @@ func TestChangeStatusSuccessNewRan(t *testing.T) {
        origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_UNKNOWN_CONNECTION_STATUS}
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
-       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
+       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, RanName+"_"+CONNECTED_RAW_EVENT).Return(nil)
        ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
        ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil)
        err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
@@ -101,7 +105,7 @@ func TestChangeStatusSuccessEventConnected(t *testing.T) {
        origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED}
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
-       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
+       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, RanName+"_"+CONNECTED_RAW_EVENT).Return(nil)
        ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
        ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil)
        err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
@@ -117,7 +121,7 @@ func TestChangeStatusSuccessEventDisconnected(t *testing.T) {
        origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_CONNECTED}
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
-       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + DISCONNECTED_RAW_EVENT).Return(nil)
+       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, RanName+"_"+DISCONNECTED_RAW_EVENT).Return(nil)
        ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
        ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil)
        err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_DISCONNECTED)
@@ -147,7 +151,7 @@ func TestChangeStatusRnibErrorEventConnected(t *testing.T) {
        origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED}
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
-       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(common.NewInternalError(errors.New("Error")))
+       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, RanName+"_"+CONNECTED_RAW_EVENT).Return(common.NewInternalError(errors.New("Error")))
        err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
        assert.NotNil(t, err)
        writerMock.AssertExpectations(t)
@@ -176,7 +180,7 @@ func TestChangeStatusRanAlarmServiceErrorEventConnected(t *testing.T) {
        origNodebInfo := &entities.NodebInfo{RanName: ranName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED}
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
-       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
+       writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, RanName+"_"+CONNECTED_RAW_EVENT).Return(nil)
        ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
        ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(common.NewInternalError(errors.New("Error")))
        err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
@@ -184,4 +188,4 @@ func TestChangeStatusRanAlarmServiceErrorEventConnected(t *testing.T) {
        writerMock.AssertExpectations(t)
        ranListManagerMock.AssertExpectations(t)
        ranAlarmServiceMock.AssertExpectations(t)
-}
\ No newline at end of file
+}