Skip to content

Commit

Permalink
DXE-3547 Merge pull request #199 from akamai/release/v7.6.1
Browse files Browse the repository at this point in the history
Release/v7.6.1
  • Loading branch information
wzagrajcz authored Feb 14, 2024
2 parents 4eba719 + f83132b commit a944412
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# EDGEGRID GOLANG RELEASE NOTES

## 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)

#### FEATURES/ENHANCEMENTS:
Expand Down
2 changes: 1 addition & 1 deletion pkg/edgeworkers/activations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 52 additions & 7 deletions pkg/edgeworkers/activations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package edgeworkers
import (
"context"
"errors"
"io/ioutil"
"net/http"
"net/http/httptest"
"regexp"
Expand Down Expand Up @@ -275,22 +276,25 @@ 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{
EdgeWorkerID: 42,
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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a944412

Please sign in to comment.