X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fcontrollers%2Fnodeb_controller_test.go;h=bfdf2703d555e82295a06b52aa75aabf824d4fca;hb=0fb24ff00209041b316352327e2c73b699943131;hp=f57522c7841924a480c538a8c5aaf0402709c10c;hpb=7bd44bd2bab64defc41bdc5da6571f6bfe913da6;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/controllers/nodeb_controller_test.go b/E2Manager/controllers/nodeb_controller_test.go index f57522c..bfdf270 100644 --- a/E2Manager/controllers/nodeb_controller_test.go +++ b/E2Manager/controllers/nodeb_controller_test.go @@ -1,6 +1,7 @@ // // Copyright 2019 AT&T Intellectual Property // Copyright 2019 Nokia +// Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -160,9 +161,7 @@ func generateServedNrCells(cellIds ...string) []*entities.ServedNRCell { servedNrCells = append(servedNrCells, &entities.ServedNRCell{ServedNrCellInformation: &entities.ServedNRCellInformation{ CellId: v, ChoiceNrMode: &entities.ServedNRCellInformation_ChoiceNRMode{ - Fdd: &entities.ServedNRCellInformation_ChoiceNRMode_FddInfo{ - - }, + Fdd: &entities.ServedNRCellInformation_ChoiceNRMode_FddInfo{}, }, NrMode: entities.Nr_FDD, NrPci: 5, @@ -631,8 +630,7 @@ func TestControllerUpdateGnbEmptyServedNrCells(t *testing.T) { context := controllerUpdateGnbTestContext{ getNodebInfoResult: nil, requestBody: map[string]interface{}{ - "servedNrCells": []interface{}{ - }, + "servedNrCells": []interface{}{}, }, expectedStatusCode: http.StatusBadRequest, expectedJsonResponse: ValidationFailureJson, @@ -1176,16 +1174,16 @@ func TestControllerUpdateEnbNgEnbFailure(t *testing.T) { oldServedCells := generateServedCells("whatever1", "whatever2") context := controllerUpdateEnbTestContext{ - getNodebInfoResult: &getNodebInfoResult{ - nodebInfo: &entities.NodebInfo{ - RanName: RanName, - ConnectionStatus: entities.ConnectionStatus_CONNECTED, - AssociatedE2TInstanceAddress: AssociatedE2TInstanceAddress, - NodeType: entities.Node_ENB, - Configuration: &entities.NodebInfo_Enb{Enb: &entities.Enb{ServedCells: oldServedCells, EnbType: entities.EnbType_MACRO_NG_ENB}}, - }, - rnibError: nil, - }, + getNodebInfoResult: &getNodebInfoResult{ + nodebInfo: &entities.NodebInfo{ + RanName: RanName, + ConnectionStatus: entities.ConnectionStatus_CONNECTED, + AssociatedE2TInstanceAddress: AssociatedE2TInstanceAddress, + NodeType: entities.Node_ENB, + Configuration: &entities.NodebInfo_Enb{Enb: &entities.Enb{ServedCells: oldServedCells, EnbType: entities.EnbType_MACRO_NG_ENB}}, + }, + rnibError: nil, + }, requestBody: requestBody, expectedStatusCode: http.StatusBadRequest, expectedJsonResponse: ValidationFailureJson, @@ -1807,6 +1805,10 @@ func TestHandleErrorResponse(t *testing.T) { controller.handleErrorResponse(e2managererrors.NewRmrError(), writer) assert.Equal(t, http.StatusInternalServerError, writer.Result().StatusCode) + writer = httptest.NewRecorder() + controller.handleErrorResponse(e2managererrors.NewNoConnectedRanError(), writer) + assert.Equal(t, http.StatusNotFound, writer.Result().StatusCode) + writer = httptest.NewRecorder() controller.handleErrorResponse(e2managererrors.NewResourceNotFoundError(), writer) assert.Equal(t, http.StatusNotFound, writer.Result().StatusCode)