From ce6ecc66b565a303073e5c79abe741fcaac4c319 Mon Sep 17 00:00:00 2001 From: Roni Riska Date: Tue, 28 Jan 2020 11:58:06 +0200 Subject: [PATCH] Update appmgr request New appmgr wants a bit different post to the notification subscribe API. Change-Id: I5afc99e5d786e6b964325cba70922fd8c6e66011 Signed-off-by: Roni Riska --- cmd/vesmgr/subscribexAPPNotifications.go | 2 +- cmd/vesmgr/subscribexAPPNotifications_test.go | 7 ++++--- container-tag.yaml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/vesmgr/subscribexAPPNotifications.go b/cmd/vesmgr/subscribexAPPNotifications.go index 1a2b85b..df12b93 100644 --- a/cmd/vesmgr/subscribexAPPNotifications.go +++ b/cmd/vesmgr/subscribexAPPNotifications.go @@ -38,7 +38,7 @@ var errPostingFailed = errors.New("Posting subscriptions failed") var errWrongStatusCode = errors.New("Wrong subscriptions response StatusCode") func subscribexAppNotifications(targetURL string, subscriptions chan subscriptionNotification, timeout time.Duration, subsURL string) { - requestBody := []byte(fmt.Sprintf(`{"maxRetries": 5, "retryTimer": 5, "eventType":"all", "targetUrl": "%v"}`, targetURL)) + requestBody := []byte(fmt.Sprintf(`{"Data": {"maxRetries": 5, "retryTimer": 5, "eventType":"all", "targetUrl": "%v"}}`, targetURL)) req, err := http.NewRequest("POST", subsURL, bytes.NewBuffer(requestBody)) if err != nil { logger.Error("Setting NewRequest failed: %s", err) diff --git a/cmd/vesmgr/subscribexAPPNotifications_test.go b/cmd/vesmgr/subscribexAPPNotifications_test.go index 91aea4e..1521da3 100644 --- a/cmd/vesmgr/subscribexAPPNotifications_test.go +++ b/cmd/vesmgr/subscribexAPPNotifications_test.go @@ -57,9 +57,10 @@ func (suite *AppmgrHTTPServerTestSuite) TestSubscribexAppNotifications() { var result map[string]interface{} err := json.Unmarshal([]byte(body), &result) suite.Nil(err) - suite.Equal(5, int(result["maxRetries"].(float64))) - suite.Equal(5, int(result["retryTimer"].(float64))) - suite.Equal("all", result["eventType"].(string)) + data := result["Data"].(map[string]interface{}) + suite.Equal(5, int(data["maxRetries"].(float64))) + suite.Equal(5, int(data["retryTimer"].(float64))) + suite.Equal("all", data["eventType"].(string)) suite.Equal("POST", req.Method) res.Header().Add("Content-Type", "application/json") res.WriteHeader(http.StatusCreated) diff --git a/container-tag.yaml b/container-tag.yaml index ffc2a6e..7cd5ae0 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,4 +1,4 @@ # The Jenkins job uses this string for the tag in the image name # for example nexus3.o-ran-sc.org:10004/my-image-name:0.0.1 --- -tag: 0.0.8 +tag: 0.0.9 -- 2.16.6