-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from trussworks/mk-govcloud-support
Support govcloud regions and remove environment hardcoding
- Loading branch information
Showing
7 changed files
with
109 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
repos: | ||
- repo: git://github.com/golangci/golangci-lint | ||
rev: v1.28.2 | ||
rev: v1.34.1 | ||
hooks: | ||
- id: golangci-lint | ||
|
||
- repo: git://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.1.0 | ||
rev: v3.4.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
- id: trailing-whitespace | ||
|
||
- repo: git://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.23.2 | ||
rev: v0.26.0 | ||
hooks: | ||
- id: markdownlint | ||
|
||
- repo: git://github.com/trussworks/pre-commit-hooks | ||
rev: v0.0.4 | ||
rev: v1.0.0 | ||
hooks: | ||
- id: circleci-validate | ||
- id: goreleaser-check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
module github.com/trussworks/ecs-service-logs | ||
|
||
go 1.14 | ||
go 1.15 | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go v1.36.19 | ||
github.com/pkg/errors v0.9.1 | ||
github.com/spf13/cobra v0.0.7 | ||
github.com/spf13/pflag v1.0.5 | ||
github.com/spf13/viper v1.7.1 | ||
github.com/stretchr/testify v1.3.0 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package main | ||
|
||
import ( | ||
"io/ioutil" | ||
"log" | ||
"os" | ||
"testing" | ||
|
||
"github.com/aws/aws-sdk-go/aws/endpoints" | ||
"github.com/spf13/viper" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type cliTestSuite struct { | ||
suite.Suite | ||
viper *viper.Viper | ||
logger *log.Logger | ||
} | ||
|
||
func (suite *cliTestSuite) Setup() { | ||
// Disable any logging that isn't attached to the logger unless using the verbose flag | ||
log.SetOutput(ioutil.Discard) | ||
log.SetFlags(0) | ||
|
||
// Setup logger | ||
var logger = log.New(os.Stdout, "", log.LstdFlags) | ||
|
||
// Remove the flags for the logger | ||
logger.SetFlags(0) | ||
suite.SetLogger(logger) | ||
|
||
// Setup viper | ||
v := viper.New() | ||
suite.SetViper(v) | ||
} | ||
|
||
func (suite *cliTestSuite) TestCheckRegion() { | ||
suite.Setup() | ||
|
||
testValues := []string{ | ||
endpoints.UsEast1RegionID, | ||
endpoints.UsEast2RegionID, | ||
endpoints.UsWest1RegionID, | ||
endpoints.UsWest2RegionID, | ||
endpoints.UsGovWest1RegionID, | ||
} | ||
for _, testValue := range testValues { | ||
suite.viper.Set(flagAWSRegion, testValue) | ||
suite.NoError(checkRegion(suite.viper)) | ||
} | ||
testValuesWithErrors := []string{ | ||
"AnyOtherRegionName", | ||
} | ||
for _, testValue := range testValuesWithErrors { | ||
suite.viper.Set(flagAWSRegion, testValue) | ||
suite.Error(checkRegion(suite.viper)) | ||
} | ||
} | ||
|
||
func (suite *cliTestSuite) SetViper(v *viper.Viper) { | ||
suite.viper = v | ||
} | ||
|
||
func (suite *cliTestSuite) SetLogger(logger *log.Logger) { | ||
suite.logger = logger | ||
} | ||
|
||
func TestCLISuite(t *testing.T) { | ||
suite.Run(t, &cliTestSuite{}) | ||
} |