summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/orchestrator/api/projecthandler.go8
-rw-r--r--src/orchestrator/api/projecthandler_test.go16
-rwxr-xr-xsrc/orchestrator/scripts/start-dev.sh1
3 files changed, 21 insertions, 4 deletions
diff --git a/src/orchestrator/api/projecthandler.go b/src/orchestrator/api/projecthandler.go
index 07cd79ce..e88114a1 100644
--- a/src/orchestrator/api/projecthandler.go
+++ b/src/orchestrator/api/projecthandler.go
@@ -167,7 +167,13 @@ func (h projectHandler) deleteHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
name := vars["project-name"]
- err := h.client.DeleteProject(name)
+ _, err := h.client.GetProject(name)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusNotFound)
+ return
+ }
+
+ err = h.client.DeleteProject(name)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
diff --git a/src/orchestrator/api/projecthandler_test.go b/src/orchestrator/api/projecthandler_test.go
index 5e88bab9..639a2661 100644
--- a/src/orchestrator/api/projecthandler_test.go
+++ b/src/orchestrator/api/projecthandler_test.go
@@ -323,11 +323,23 @@ func TestProjectDeleteHandler(t *testing.T) {
label: "Delete Project",
expectedCode: http.StatusNoContent,
name: "testProject",
- projectClient: &mockProjectManager{},
+ projectClient: &mockProjectManager{
+ //Items that will be returned by the mocked Client
+ Items: []moduleLib.Project{
+ {
+ MetaData: moduleLib.ProjectMetaData{
+ Name: "testProject",
+ Description: "Test Project used for unit testing",
+ UserData1: "data1",
+ UserData2: "data2",
+ },
+ },
+ },
+ },
},
{
label: "Delete Non-Exiting Project",
- expectedCode: http.StatusInternalServerError,
+ expectedCode: http.StatusNotFound,
name: "testProject",
projectClient: &mockProjectManager{
Err: pkgerrors.New("Internal Error"),
diff --git a/src/orchestrator/scripts/start-dev.sh b/src/orchestrator/scripts/start-dev.sh
index ad21dc47..775b218f 100755
--- a/src/orchestrator/scripts/start-dev.sh
+++ b/src/orchestrator/scripts/start-dev.sh
@@ -28,6 +28,5 @@ echo "Compiling source code"
pushd $opath
generate_config
make all
-cp -r $k8s_path/src/orchestrator/json-schemas $k8s_path/src/orchestrator
./orchestrator
popd