+}
+
+func TestResetKeepAliveTimestampsForAllE2TInstancesGetE2TInstancesFailure(t *testing.T) {
+ rnibReaderMock, rnibWriterMock, e2tInstancesManager := initE2TInstancesManagerTest(t)
+ rnibReaderMock.On("GetE2TAddresses").Return([]string{}, common.NewInternalError(errors.New("Error")))
+ e2tInstancesManager.ResetKeepAliveTimestampsForAllE2TInstances()
+ rnibWriterMock.AssertNotCalled(t, "SaveE2TInstance")
+}
+
+func TestResetKeepAliveTimestampsForAllE2TInstancesNoInstances(t *testing.T) {
+ rnibReaderMock, rnibWriterMock, e2tInstancesManager := initE2TInstancesManagerTest(t)
+ rnibReaderMock.On("GetE2TAddresses").Return([]string{}, nil)
+ e2tInstancesManager.ResetKeepAliveTimestampsForAllE2TInstances()
+ rnibWriterMock.AssertNotCalled(t, "SaveE2TInstance")
+}
+
+func TestResetKeepAliveTimestampsForAllE2TInstancesNoActiveInstances(t *testing.T) {
+ rnibReaderMock, rnibWriterMock, e2tInstancesManager := initE2TInstancesManagerTest(t)
+ e2tAddresses := []string{E2TAddress, E2TAddress2}
+ rnibReaderMock.On("GetE2TAddresses").Return(e2tAddresses, nil)
+ e2tInstance1 := entities.NewE2TInstance(E2TAddress)
+ e2tInstance1.State = entities.ToBeDeleted
+ e2tInstance2 := entities.NewE2TInstance(E2TAddress2)
+ e2tInstance2.State = entities.RoutingManagerFailure
+ rnibReaderMock.On("GetE2TInstances", e2tAddresses).Return([]*entities.E2TInstance{e2tInstance1, e2tInstance2}, nil)
+ e2tInstancesManager.ResetKeepAliveTimestampsForAllE2TInstances()
+ rnibWriterMock.AssertNotCalled(t, "SaveE2TInstance")
+}
+
+func TestResetKeepAliveTimestampsForAllE2TInstancesOneActiveInstance(t *testing.T) {
+ rnibReaderMock, rnibWriterMock, e2tInstancesManager := initE2TInstancesManagerTest(t)
+ e2tAddresses := []string{E2TAddress, E2TAddress2}
+ rnibReaderMock.On("GetE2TAddresses").Return(e2tAddresses, nil)
+ e2tInstance1 := entities.NewE2TInstance(E2TAddress)
+ e2tInstance1.State = entities.Active
+ e2tInstance2 := entities.NewE2TInstance(E2TAddress2)
+ e2tInstance2.State = entities.ToBeDeleted
+ rnibReaderMock.On("GetE2TInstances", e2tAddresses).Return([]*entities.E2TInstance{e2tInstance1, e2tInstance2}, nil)
+ rnibWriterMock.On("SaveE2TInstance", mock.Anything).Return(nil)
+ e2tInstancesManager.ResetKeepAliveTimestampsForAllE2TInstances()
+ rnibWriterMock.AssertNumberOfCalls(t, "SaveE2TInstance",1)
+}
+
+func TestResetKeepAliveTimestampsForAllE2TInstancesSaveE2TInstanceFailure(t *testing.T) {
+ rnibReaderMock, rnibWriterMock, e2tInstancesManager := initE2TInstancesManagerTest(t)
+ e2tAddresses := []string{E2TAddress, E2TAddress2}
+ rnibReaderMock.On("GetE2TAddresses").Return(e2tAddresses, nil)
+ e2tInstance1 := entities.NewE2TInstance(E2TAddress)
+ e2tInstance1.State = entities.Active
+ e2tInstance2 := entities.NewE2TInstance(E2TAddress2)
+ e2tInstance2.State = entities.ToBeDeleted
+ rnibReaderMock.On("GetE2TInstances", e2tAddresses).Return([]*entities.E2TInstance{e2tInstance1, e2tInstance2}, nil)
+ rnibWriterMock.On("SaveE2TInstance", mock.Anything).Return(common.NewInternalError(errors.New("Error")))
+ e2tInstancesManager.ResetKeepAliveTimestampsForAllE2TInstances()
+ rnibWriterMock.AssertNumberOfCalls(t, "SaveE2TInstance",1)
+}