From 3f2f7ce2d1b8d90c385890eafc48cf372e1e09d3 Mon Sep 17 00:00:00 2001 From: Michal Mazur Date: Fri, 9 Feb 2024 09:27:44 +0000 Subject: [PATCH 1/2] DXE-3436 Changelog boilerplate --- CHANGELOG.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87e87d0a..c68442b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,58 @@ # EDGEGRID GOLANG RELEASE NOTES +## 8.0.0 (X X, X) + +#### BREAKING CHANGES: + + + + + + + + + + + + + + + + +#### FEATURES/ENHANCEMENTS: + + + + + + + + + + + + + + + + +#### BUG FIXES: + + + + + + + + + + + + + + + + ## 7.6.0 (February 8, 2024) #### FEATURES/ENHANCEMENTS: From f83132b74b70ecb3eec890106b73fffafe63adac Mon Sep 17 00:00:00 2001 From: "Zagrajczuk, Wojciech" Date: Wed, 14 Feb 2024 10:45:50 +0100 Subject: [PATCH 2/2] DXE-3529 Fix sending empty note --- CHANGELOG.md | 52 ++----------------------- pkg/edgeworkers/activations.go | 2 +- pkg/edgeworkers/activations_test.go | 59 +++++++++++++++++++++++++---- 3 files changed, 56 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c68442b1..8502a72a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,57 +1,11 @@ # EDGEGRID GOLANG RELEASE NOTES -## 8.0.0 (X X, X) - -#### BREAKING CHANGES: - - - - - - - - - - - - - - - - -#### FEATURES/ENHANCEMENTS: - - - - - - - - - - - - - - - +## 7.6.1 (February 14, 2024) #### BUG FIXES: - - - - - - - - - - - - - - +* Edgeworkers + * Fixed case when not providing optional `note` field in `ActivateVersion` would cause activation to fail ## 7.6.0 (February 8, 2024) diff --git a/pkg/edgeworkers/activations.go b/pkg/edgeworkers/activations.go index 3917a2f1..23fcd8ec 100644 --- a/pkg/edgeworkers/activations.go +++ b/pkg/edgeworkers/activations.go @@ -50,7 +50,7 @@ type ( ActivateVersion struct { Network ActivationNetwork `json:"network"` Version string `json:"version"` - Note string `json:"note"` + Note string `json:"note,omitempty"` } // ActivationNetwork represents available activation network types diff --git a/pkg/edgeworkers/activations_test.go b/pkg/edgeworkers/activations_test.go index c2dcf2bd..1e1f9edf 100644 --- a/pkg/edgeworkers/activations_test.go +++ b/pkg/edgeworkers/activations_test.go @@ -3,6 +3,7 @@ package edgeworkers import ( "context" "errors" + "io/ioutil" "net/http" "net/http/httptest" "regexp" @@ -275,12 +276,13 @@ func TestGetActivation(t *testing.T) { func TestActivateVersion(t *testing.T) { tests := map[string]struct { - params ActivateVersionRequest - responseStatus int - responseBody string - expectedPath string - expectedResponse *Activation - withError error + params ActivateVersionRequest + responseStatus int + responseBody string + expectedPath string + expectedRequestBody string + expectedResponse *Activation + withError error }{ "200 OK": { params: ActivateVersionRequest{ @@ -288,9 +290,11 @@ func TestActivateVersion(t *testing.T) { ActivateVersion: ActivateVersion{ Network: "STAGING", Version: "1", + Note: "activation note1", }, }, - responseStatus: http.StatusCreated, + expectedRequestBody: `{"network":"STAGING","version":"1","note":"activation note1"}`, + responseStatus: http.StatusCreated, responseBody: ` { "edgeWorkerId": 42, @@ -318,6 +322,41 @@ func TestActivateVersion(t *testing.T) { Note: "activation note1", }, }, + "200 without note": { + params: ActivateVersionRequest{ + EdgeWorkerID: 42, + ActivateVersion: ActivateVersion{ + Network: "STAGING", + Version: "1", + }, + }, + expectedRequestBody: `{"network":"STAGING","version":"1"}`, + responseStatus: http.StatusCreated, + responseBody: ` +{ + "edgeWorkerId": 42, + "version": "1", + "activationId": 1, + "accountId": "B-M-1KQK3WU", + "status": "PRESUBMIT", + "network": "STAGING", + "createdBy": "jsmith", + "createdTime": "2018-07-09T08:13:54Z", + "lastModifiedTime": "2018-07-09T08:35:02Z" +}`, + expectedPath: "/edgeworkers/v1/ids/42/activations", + expectedResponse: &Activation{ + AccountID: "B-M-1KQK3WU", + ActivationID: 1, + CreatedBy: "jsmith", + CreatedTime: "2018-07-09T08:13:54Z", + EdgeWorkerID: 42, + LastModifiedTime: "2018-07-09T08:35:02Z", + Network: "STAGING", + Status: "PRESUBMIT", + Version: "1", + }, + }, "500 internal server error": { params: ActivateVersionRequest{ EdgeWorkerID: 42, @@ -374,6 +413,12 @@ func TestActivateVersion(t *testing.T) { w.WriteHeader(test.responseStatus) _, err := w.Write([]byte(test.responseBody)) assert.NoError(t, err) + + if len(test.expectedRequestBody) > 0 { + body, err := ioutil.ReadAll(r.Body) + require.NoError(t, err) + assert.Equal(t, test.expectedRequestBody, string(body)) + } })) client := mockAPIClient(t, mockServer) result, err := client.ActivateVersion(context.Background(), test.params)