+ readerMock.AssertCalled(t, "GetNodeb", ranName)
+ writerMock.AssertNumberOfCalls(t, "UpdateNodebInfo", 1)
+ rmrMessengerMock.AssertNumberOfCalls(t, "SendMsg", 1)
+}
+
+func TestConnectedRanExecuteSetupFailure(t *testing.T) {
+ _, _, readerMock, writerMock, ranReconnectionManager := initRanLostConnectionTest(t)
+ ranName := "test"
+ origNodebInfo := &entities.NodebInfo{RanName: ranName, GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTED}
+ var rnibErr error
+ readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
+ updatedNodebInfo := *origNodebInfo
+ updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTING
+ updatedNodebInfo.ConnectionAttempts++
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo).Return(common.NewInternalError(errors.New("Error")))
+ err := ranReconnectionManager.ReconnectRan(ranName)
+ assert.NotNil(t, err)
+ readerMock.AssertCalled(t, "GetNodeb", ranName)
+ writerMock.AssertNumberOfCalls(t, "UpdateNodebInfo", 1)
+}
+
+func TestNoSetConnectionStatus(t *testing.T) {
+ _, _, _, _, ranReconnectionManager := initRanLostConnectionTest(t)
+ nodebInfo := &entities.NodebInfo{RanName: "ranName", GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTED}
+ err := ranReconnectionManager.updateUnconnectableRan(nodebInfo)
+ assert.Nil(t, err)