+}
+/*
+func TestShutdownSuccess2Instance2Rans(t *testing.T) {
+ shutdownManager, readerMock, writerMock, httpClientMock,kubernetesManager := initE2TShutdownManagerTest(t)
+
+ e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName)
+ e2tInstance1.State = entities.Active
+ e2tInstance1.AssociatedRanList = []string{"test2"}
+ writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil)
+
+ nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress2, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST}
+ nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_DISCONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST}
+ readerMock.On("GetNodeb", "test2").Return(nodeb2, nil)
+
+ data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, []string{"test2"}, nil)
+ marshaled, _ := json.Marshal(data)
+ body := bytes.NewBuffer(marshaled)
+ respBody := ioutil.NopCloser(bytes.NewBufferString(""))
+ httpClientMock.On("Delete", "e2t", "application/json", body).Return(&http.Response{StatusCode: http.StatusCreated, Body: respBody}, nil)
+
+ writerMock.On("RemoveE2TInstance", E2TAddress).Return(nil)
+ readerMock.On("GetE2TAddresses").Return([]string{E2TAddress}, nil)
+ writerMock.On("SaveE2TAddresses", []string{}).Return(nil)
+
+ nodeb1new := *nodeb1
+ nodeb1new.AssociatedE2TInstanceAddress = ""
+ nodeb1new.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ nodeb2new := *nodeb2
+ nodeb2new.AssociatedE2TInstanceAddress = ""
+ nodeb2new.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ writerMock.On("UpdateNodebInfo", &nodeb2new).Return(nil)
+
+ test := TestStruct{
+ description: "namespace, 2 pods in Oran",
+ namespace: "oran",
+ objs: []runtime.Object{pod("oran", PodName), pod("oran", "e2t_2"), pod("some-namespace", "POD_Test_1")},
+ }
+
+ t.Run(test.description, func(t *testing.T) {
+ kubernetesManager.ClientSet = fake.NewSimpleClientset(test.objs...)
+
+ err := shutdownManager.Shutdown(e2tInstance1)
+
+ assert.Nil(t, err)
+ readerMock.AssertExpectations(t)
+ writerMock.AssertExpectations(t)
+ httpClientMock.AssertExpectations(t)
+ })
+}
+
+func TestShutdownSuccess2Instance2RansNoPod(t *testing.T) {
+ shutdownManager, readerMock, writerMock, httpClientMock,kubernetesManager := initE2TShutdownManagerTest(t)
+
+ e2tInstance1 := entities.NewE2TInstance(E2TAddress, PodName)
+ e2tInstance1.State = entities.Active
+ e2tInstance1.AssociatedRanList = []string{"test2"}
+ writerMock.On("SaveE2TInstance", mock.MatchedBy(func(e2tInstance *entities.E2TInstance) bool { return e2tInstance.Address == E2TAddress && e2tInstance.State == entities.ToBeDeleted })).Return(nil)
+
+ nodeb1 := &entities.NodebInfo{RanName:"test1", AssociatedE2TInstanceAddress:E2TAddress2, ConnectionStatus:entities.ConnectionStatus_CONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST}
+ nodeb2 := &entities.NodebInfo{RanName:"test2", AssociatedE2TInstanceAddress:E2TAddress, ConnectionStatus:entities.ConnectionStatus_DISCONNECTED, E2ApplicationProtocol:entities.E2ApplicationProtocol_X2_SETUP_REQUEST}
+ readerMock.On("GetNodeb", "test2").Return(nodeb2, nil)
+
+ data := models.NewRoutingManagerDeleteRequestModel(E2TAddress, []string{"test2"}, nil)
+ marshaled, _ := json.Marshal(data)
+ body := bytes.NewBuffer(marshaled)
+ respBody := ioutil.NopCloser(bytes.NewBufferString(""))
+ httpClientMock.On("Delete", "e2t", "application/json", body).Return(&http.Response{StatusCode: http.StatusCreated, Body: respBody}, nil)
+
+ writerMock.On("RemoveE2TInstance", E2TAddress).Return(nil)
+ readerMock.On("GetE2TAddresses").Return([]string{E2TAddress}, nil)
+ writerMock.On("SaveE2TAddresses", []string{}).Return(nil)
+
+ nodeb1new := *nodeb1
+ nodeb1new.AssociatedE2TInstanceAddress = ""
+ nodeb1new.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ nodeb2new := *nodeb2
+ nodeb2new.AssociatedE2TInstanceAddress = ""
+ nodeb2new.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ writerMock.On("UpdateNodebInfo", &nodeb2new).Return(nil)
+
+ test := TestStruct{
+ description: "namespace, 2 pods in Oran",
+ namespace: "oran",
+ objs: []runtime.Object{pod("oran", "e2t_2"), pod("some-namespace", "POD_Test_1")},
+ }
+
+ t.Run(test.description, func(t *testing.T) {
+ kubernetesManager.ClientSet = fake.NewSimpleClientset(test.objs...)
+
+ err := shutdownManager.Shutdown(e2tInstance1)
+
+ assert.Nil(t, err)
+ readerMock.AssertExpectations(t)
+ writerMock.AssertExpectations(t)
+ httpClientMock.AssertExpectations(t)
+ })
+}*/
\ No newline at end of file