Skip to content

Commit

Permalink
release v0.32.0 (#374)
Browse files Browse the repository at this point in the history
* release v0.32.0

* update authors

* Proposal for dependencies upgrade (#375)

Co-authored-by: ftorelli <[email protected]>

* Revert "Proposal for dependencies upgrade (#375)" (#376)

This reverts commit a7cea7c.

* Add new aws-sdk-go mock methods available with new version upgrade.

* Improved test scenarios.

* update CHANGELOG.md

* bump up functional tests timeout

* bump up functional tests timeout

* update CHANGELOG.md

* update CHANGELOG.md

Co-authored-by: Fabrizio Torelli <[email protected]>
Co-authored-by: ftorelli <[email protected]>
Co-authored-by: Amy Schoen <[email protected]>
  • Loading branch information
4 people authored Oct 13, 2020
1 parent 4306865 commit da95a2b
Show file tree
Hide file tree
Showing 19 changed files with 1,655 additions and 99 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## vNext
- Add `iotanalytics:*` to the principal IAM policy
## v0.32.0
- Upgrade go to 1.15
- Upgrade go mod dependencies version.
- Improved test scenarios.
- Add `iotanalytics:*` policy to the set of allowed services.
- Increase timeout for functional test execution.

## v0.31.3
- Fix data and update visualization for codebuild reset widget and error scrappers.
Expand Down
3 changes: 2 additions & 1 deletion cmd/lambda/account_pool_metrics/main_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package main

import (
"testing"

"github.com/Optum/dce/pkg/account"
accountMocks "github.com/Optum/dce/pkg/account/accountiface/mocks"
awsMocks "github.com/Optum/dce/pkg/awsiface/mocks"
"github.com/Optum/dce/pkg/config"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"testing"
)

func TestGetMetrics(t *testing.T) {
Expand Down
15 changes: 11 additions & 4 deletions cmd/lambda/accounts/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ import (
)

func TestWhenCreate(t *testing.T) {
standardHeaders := map[string][]string{
standardMultiValueHeaders := map[string][]string{
"Access-Control-Allow-Origin": []string{"*"},
"Content-Type": []string{"application/json"},
}
standardHeaders := map[string]string{
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
}

tests := []struct {
name string
Expand All @@ -32,7 +36,8 @@ func TestWhenCreate(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusCreated,
Body: "{}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
request: events.APIGatewayProxyRequest{
HTTPMethod: http.MethodPost,
Expand All @@ -47,7 +52,8 @@ func TestWhenCreate(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusBadRequest,
Body: "{\"error\":{\"message\":\"invalid request parameters\",\"code\":\"ClientError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
request: events.APIGatewayProxyRequest{
HTTPMethod: http.MethodPost,
Expand All @@ -67,7 +73,8 @@ func TestWhenCreate(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"unknown error\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccount: nil,
retErr: fmt.Errorf("failure"),
Expand Down
15 changes: 11 additions & 4 deletions cmd/lambda/accounts/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ import (
)

func TestWhenDelete(t *testing.T) {
standardHeaders := map[string][]string{
standardMultiValueHeaders := map[string][]string{
"Access-Control-Allow-Origin": []string{"*"},
"Content-Type": []string{"application/json"},
}
standardHeaders := map[string]string{
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
}

tests := []struct {
name string
Expand All @@ -35,7 +39,8 @@ func TestWhenDelete(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusNoContent,
Body: "",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
request: events.APIGatewayProxyRequest{
HTTPMethod: http.MethodDelete,
Expand All @@ -52,7 +57,8 @@ func TestWhenDelete(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusNotFound,
Body: "{\"error\":{\"message\":\"account \\\"210987654321\\\" not found\",\"code\":\"NotFoundError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
request: events.APIGatewayProxyRequest{
HTTPMethod: http.MethodDelete,
Expand All @@ -71,7 +77,8 @@ func TestWhenDelete(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"failure\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
getAccount: &account.Account{
ID: ptrString("123456789012"),
Expand Down
42 changes: 30 additions & 12 deletions cmd/lambda/leases/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ import (
)

func TestWhenCreateSuccess(t *testing.T) {
standardHeaders := map[string][]string{
standardMultiValueHeaders := map[string][]string{
"Access-Control-Allow-Origin": []string{"*"},
"Content-Type": []string{"application/json"},
}
standardHeaders := map[string]string{
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
}

usageSvcMock := &mockUsage.DBer{}
usageSvcMock.On("GetUsageByPrincipal", mock.Anything, mock.Anything).Return(nil, nil)
Expand Down Expand Up @@ -52,7 +56,8 @@ func TestWhenCreateSuccess(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusCreated,
Body: "{}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
request: events.APIGatewayProxyRequest{
HTTPMethod: http.MethodPost,
Expand Down Expand Up @@ -85,7 +90,8 @@ func TestWhenCreateSuccess(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusCreated,
Body: "{}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
request: events.APIGatewayProxyRequest{
HTTPMethod: http.MethodPost,
Expand Down Expand Up @@ -161,10 +167,14 @@ func TestWhenCreateSuccess(t *testing.T) {
}

func TestWhenCreateError(t *testing.T) {
standardHeaders := map[string][]string{
standardMultiValueHeaders := map[string][]string{
"Access-Control-Allow-Origin": []string{"*"},
"Content-Type": []string{"application/json"},
}
standardHeaders := map[string]string{
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
}

usageSvcMock := &mockUsage.DBer{}
usageSvcMock.On("GetUsageByPrincipal", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("Error"))
Expand Down Expand Up @@ -195,7 +205,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusBadRequest,
Body: "{\"error\":{\"message\":\"invalid request parameters: missing principalId\",\"code\":\"ClientError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retLease: nil,
retListErr: nil,
Expand All @@ -216,7 +227,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusBadRequest,
Body: "{\"error\":{\"message\":\"invalid request parameters\",\"code\":\"ClientError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccounts: &account.Accounts{
account.Account{
Expand All @@ -243,7 +255,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusUnauthorized,
Body: "{\"error\":{\"message\":\"User [admin1] with role: [User] attempted to act on a lease for [User1], but was not authorized\",\"code\":\"UnauthorizedError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccounts: &account.Accounts{
account.Account{
Expand All @@ -270,7 +283,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"unknown error\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retLease: nil,
retListErr: fmt.Errorf("failure"),
Expand All @@ -291,7 +305,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"No Available accounts at this moment\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccounts: &account.Accounts{},
retLease: nil,
Expand All @@ -313,7 +328,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"unknown error\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccounts: &account.Accounts{
account.Account{
Expand All @@ -340,7 +356,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"unknown error\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccounts: &account.Accounts{
account.Account{
Expand All @@ -367,7 +384,8 @@ func TestWhenCreateError(t *testing.T) {
expResp: events.APIGatewayProxyResponse{
StatusCode: http.StatusInternalServerError,
Body: "{\"error\":{\"message\":\"unknown error\",\"code\":\"ServerError\"}}\n",
MultiValueHeaders: standardHeaders,
Headers: standardHeaders,
MultiValueHeaders: standardMultiValueHeaders,
},
retAccounts: &account.Accounts{
account.Account{
Expand Down
11 changes: 10 additions & 1 deletion cmd/lambda/leases/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import (

"context"
gErrors "errors"
"net/http"

"github.com/Optum/dce/pkg/config"
"github.com/Optum/dce/pkg/lease/leaseiface/mocks"
"github.com/aws/aws-lambda-go/events"
"github.com/stretchr/testify/assert"
"net/http"
)

func TestMain(m *testing.M) {
Expand All @@ -31,6 +32,10 @@ func MockAPIResponse(status int, body string) events.APIGatewayProxyResponse {
"Content-Type": []string{"application/json"},
"Access-Control-Allow-Origin": []string{"*"},
},
Headers: map[string]string{
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
Body: body,
}
}
Expand All @@ -43,6 +48,10 @@ func MockAPIErrorResponse(status int, body string) events.APIGatewayProxyRespons
"Content-Type": []string{"application/json"},
"Access-Control-Allow-Origin": []string{"*"},
},
Headers: map[string]string{
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
},
Body: body,
}
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/lambda/process_reset_queue/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func TestProcessResetQueue(t *testing.T) {
cfgBldr := &config.ConfigurationBuilder{}
svcBldr := &config.ServiceBuilder{Config: cfgBldr}

// var mocksCodeBuild codebuildiface.CodeBuildAPI
// mocksCodeBuild = codebuildiface.CodeBuildAPI(&mocks.CodeBuildAPI{})
mocksCodeBuild := &mocks.CodeBuildAPI{}
mocksCodeBuild.On("StartBuild", mock.Anything).Return(nil, tt.codeBuildErr)
svcBldr.Config.WithService(mocksCodeBuild)
Expand Down
61 changes: 41 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
module github.com/Optum/dce

go 1.13
go 1.15

require (
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect
github.com/avast/retry-go v2.3.0+incompatible
github.com/aws/aws-lambda-go v1.11.1
github.com/aws/aws-sdk-go v1.25.36
github.com/awslabs/aws-lambda-go-api-proxy v0.5.0
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/Bowery/prompt v0.0.0-20190419144237-972d0ceb96f5 // indirect
github.com/Joker/jade v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/avast/retry-go v2.6.0+incompatible
github.com/aws/aws-lambda-go v1.19.1
github.com/aws/aws-sdk-go v1.34.20
github.com/awslabs/aws-lambda-go-api-proxy v0.8.0
github.com/caarlos0/env v3.5.0+incompatible
github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4 // indirect
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/google/uuid v1.1.1
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.3
github.com/gorilla/schema v1.1.0
github.com/gruntwork-io/terratest v0.15.13
github.com/imdario/mergo v0.3.8
github.com/mitchellh/mapstructure v1.1.2
github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf // indirect
github.com/google/uuid v1.1.2
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/handlers v1.5.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/schema v1.2.0
github.com/gruntwork-io/terratest v0.29.0
github.com/imdario/mergo v0.3.11
github.com/iris-contrib/formBinder v5.0.0+incompatible // indirect
github.com/kardianos/govendor v1.0.9 // indirect
github.com/kataras/iris v11.1.1+incompatible // indirect
github.com/klauspost/cpuid v1.2.1 // indirect
github.com/labstack/echo v3.3.10+incompatible // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mitchellh/mapstructure v1.3.3
github.com/oleiade/reflections v1.0.0 // indirect
github.com/pkg/errors v0.8.1
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.2.0 // indirect
github.com/rebuy-de/aws-nuke v0.0.0-00010101000000-000000000000
github.com/rebuy-de/aws-nuke v1.4.0
github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd // indirect
github.com/stretchr/testify v1.4.0
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
google.golang.org/appengine v1.4.0 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/spf13/cobra v1.0.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.6.1
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009 // indirect
google.golang.org/appengine v1.6.6 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/oleiade/reflections.v1 v1.0.0
gopkg.in/yaml.v2 v2.2.8
gopkg.in/urfave/cli.v1 v1.20.0 // indirect
gopkg.in/yaml.v2 v2.3.0
)

replace github.com/rebuy-de/aws-nuke => github.com/Optum/aws-nuke v1.1.0
Loading

0 comments on commit da95a2b

Please sign in to comment.