Merge "[RICPLT-2503] Automation start and stop" into PI3
[ric-plt/e2mgr.git] / E2Manager / managers / ran_reconnection_manager_test.go
index 57d7f4f..a78dd93 100644 (file)
@@ -101,13 +101,14 @@ func TestConnectingRanWithMaxAttemptsReconnectionDeassociateSucceeds(t *testing.
        readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+       updatedNodebInfo.AssociatedE2TInstanceAddress = ""
        writerMock.On("UpdateNodebInfo", &updatedNodebInfo).Return(rnibErr)
-       e2tInstancesManagerMock.On("DeassociateRan", ranName, e2tAddress).Return(nil)
+       e2tInstancesManagerMock.On("DissociateRan", ranName, e2tAddress).Return(nil)
        err := ranReconnectionManager.ReconnectRan(ranName)
        assert.Nil(t, err)
        readerMock.AssertCalled(t, "GetNodeb", ranName)
        writerMock.AssertNumberOfCalls(t, "UpdateNodebInfo", 1)
-       e2tInstancesManagerMock.AssertCalled(t, "DeassociateRan", ranName, e2tAddress)
+       e2tInstancesManagerMock.AssertCalled(t, "DissociateRan", ranName, e2tAddress)
 }
 
 func TestConnectingRanWithMaxAttemptsReconnectionDeassociateFails(t *testing.T) {
@@ -119,13 +120,14 @@ func TestConnectingRanWithMaxAttemptsReconnectionDeassociateFails(t *testing.T)
        readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
        updatedNodebInfo := *origNodebInfo
        updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+       updatedNodebInfo.AssociatedE2TInstanceAddress = ""
        writerMock.On("UpdateNodebInfo", &updatedNodebInfo).Return(rnibErr)
-       e2tInstancesManagerMock.On("DeassociateRan", ranName, e2tAddress).Return(common.NewInternalError(errors.New("Error")))
+       e2tInstancesManagerMock.On("DissociateRan", ranName, e2tAddress).Return(common.NewInternalError(errors.New("Error")))
        err := ranReconnectionManager.ReconnectRan(ranName)
        assert.NotNil(t, err)
        readerMock.AssertCalled(t, "GetNodeb", ranName)
        writerMock.AssertNumberOfCalls(t, "UpdateNodebInfo", 1)
-       e2tInstancesManagerMock.AssertCalled(t, "DeassociateRan", ranName, e2tAddress)
+       e2tInstancesManagerMock.AssertCalled(t, "DissociateRan", ranName, e2tAddress)
 }
 
 func TestUnconnectableRanUpdateNodebInfoFailure(t *testing.T) {
@@ -177,17 +179,10 @@ func TestConnectedRanExecuteSetupFailure(t *testing.T) {
        writerMock.AssertNumberOfCalls(t, "UpdateNodebInfo", 1)
 }
 
-func TestUnnecessaryUpdateNodebInfoStatus(t *testing.T) {
-       _, _, _, _, ranReconnectionManager, _ := initRanLostConnectionTest(t)
-       nodebInfo := &entities.NodebInfo{RanName: "ranName", GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTED}
-       err := ranReconnectionManager.updateNodebInfoStatus(nodebInfo, entities.ConnectionStatus_CONNECTED)
-       assert.Nil(t, err)
-}
-
 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.setConnectionStatusOfUnconnectableRan(nodebInfo)
+       err := ranReconnectionManager.updateUnconnectableRan(nodebInfo)
        assert.Nil(t, err)
 }