NONRTRIC-946: Servicemanager - mock kong and capif as library
[nonrtric/plt/sme.git] / servicemanager / internal / publishserviceapi / typeupdate.go
index 451f54b..e8a1f9c 100644 (file)
@@ -145,7 +145,8 @@ func (sd *ServiceAPIDescription) createKongRoute(
        if resp.StatusCode() == http.StatusCreated {
                log.Infof("kong route %s created successfully", routeName)
        } else {
-               err = fmt.Errorf("the Kong service already exists. Status code: %d", resp.StatusCode())
+               log.Debugf("kongRoutesURL %s", kongRoutesURL)
+               err = fmt.Errorf("error creating Kong route. Status code: %d", resp.StatusCode())
                log.Error(err.Error())
                log.Errorf("response body: %s", resp.Body())
                return resp.StatusCode(), err
@@ -237,7 +238,7 @@ func (sd *ServiceAPIDescription) createKongService(kongControlPlaneURL string, k
        } else if resp.StatusCode() == http.StatusConflict {
                log.Errorf("kong service already exists. Status code: %d", resp.StatusCode())
                err = fmt.Errorf("service with identical apiName is already published") // for compatibilty with Capif error message on a duplicate service
-               statusCode = http.StatusForbidden // for compatibilty with the spec, TS29222_CAPIF_Publish_Service_API
+               statusCode = http.StatusForbidden                                       // for compatibilty with the spec, TS29222_CAPIF_Publish_Service_API
        } else {
                err = fmt.Errorf("error creating Kong service. Status code: %d", resp.StatusCode())
        }
@@ -350,6 +351,7 @@ func (sd *ServiceAPIDescription) deleteKongRoute(kongControlPlaneURL string, cli
        if resp.StatusCode() == http.StatusNoContent {
                log.Infof("kong route %s deleted successfully", routeName)
        } else {
+               log.Debugf("kongRoutesURL: %s", kongRoutesURL)
                log.Errorf("error deleting Kong route. Status code: %d", resp.StatusCode())
                log.Errorf("response body: %s", resp.Body())
                return resp.StatusCode(), err
@@ -386,6 +388,7 @@ func (sd *ServiceAPIDescription) deleteKongService(kongControlPlaneURL string, s
        if resp.StatusCode() == http.StatusNoContent {
                log.Infof("kong service %s deleted successfully", serviceName)
        } else {
+               log.Debugf("kongServicesURL: %s", kongServicesURL)
                log.Errorf("deleting Kong service, status code: %d", resp.StatusCode())
                log.Errorf("response body: %s", resp.Body())
        }