Skip to content

Commit

Permalink
Merge pull request #104 from Clever/go-modules
Browse files Browse the repository at this point in the history
[automated] Migrate from dep to go mod
  • Loading branch information
taylor-sutton authored Jul 20, 2021
2 parents 33608f5 + 7880607 commit fcf3680
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 297 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
docker:
- image: circleci/golang:1.13-stretch
environment:
GOPRIVATE: github.com/Clever/*
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
steps:
Expand All @@ -16,6 +17,11 @@ jobs:
- run:
command: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
name: Set up CircleCI artifacts directories
- run:
command: git config --global "url.ssh://[email protected]/Clever".insteadOf "https://github.com/Clever"
- run:
name: Add github.com to known hosts
command: mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
- run: make install_deps
- run: make build
- run: make test
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
vendor/
bin/
release/
gen-go/
mocks/mock_*.go
cmd/sfncli/sfncli
188 changes: 0 additions & 188 deletions Gopkg.lock

This file was deleted.

22 changes: 0 additions & 22 deletions Gopkg.toml

This file was deleted.

17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include golang.mk
.DEFAULT_GOAL := test # override default goal set in library makefile

SHELL := /bin/bash
PKGS := $(shell go list ./... | grep -v /vendor)
PKGS := $(shell go list ./... | grep -v /vendor | grep -v /tools)
VERSION := $(shell head -n 1 VERSION)
EXECUTABLE := sfncli
EXECUTABLE_PKG := github.com/Clever/sfncli/cmd/sfncli
Expand Down Expand Up @@ -37,11 +37,10 @@ clean:

mocks:
mkdir -p bin
go build -o ./bin/mockgen ./vendor/github.com/golang/mock/mockgen
rm -rf gen-go/mocksfn && mkdir -p gen-go/mocksfn
./bin/mockgen -source vendor/github.com/aws/aws-sdk-go/service/sfn/sfniface/interface.go -destination gen-go/mocksfn/mocksfn.go -package mocksfn
rm -rf gen-go/mockcloudwatch && mkdir -p gen-go/mockcloudwatch
./bin/mockgen -source vendor/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go -destination gen-go/mockcloudwatch/mockcloudwatch.go -package mockcloudwatch

install_deps: golang-dep-vendor-deps
$(call golang-dep-vendor)
go build -o ./bin/mockgen github.com/golang/mock/mockgen
rm -rf mocks/mock_*.go
./bin/mockgen -source ./vendor/github.com/aws/aws-sdk-go/service/sfn/sfniface/interface.go -destination mocks/mock_sfn.go -package mocks
./bin/mockgen -source ./vendor/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go -destination mocks/mock_cloudwatch.go -package mocks

install_deps:
go mod vendor
3 changes: 2 additions & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
v0.6.0
v0.7.0
Migrate to go modules.
14 changes: 7 additions & 7 deletions cmd/sfncli/cloudwatchreporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/Clever/sfncli/gen-go/mockcloudwatch"
"github.com/Clever/sfncli/mocks"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/golang/mock/gomock"
Expand All @@ -21,7 +21,7 @@ func TestCloudWatchReporterReportsActiveZero(t *testing.T) {
defer testCtxCancel()
controller := gomock.NewController(t)
defer controller.Finish()
mockCW := mockcloudwatch.NewMockCloudWatchAPI(controller)
mockCW := mocks.NewMockCloudWatchAPI(controller)
cwr := NewCloudWatchReporter(mockCW, mockActivityArn)
go cwr.ReportActivePercent(testCtx, 100*time.Millisecond)
mockCW.EXPECT().PutMetricData(&cloudwatch.PutMetricDataInput{
Expand All @@ -44,7 +44,7 @@ func TestCloudWatchReporterReportsActiveFiftyPercent(t *testing.T) {
defer testCtxCancel()
controller := gomock.NewController(t)
defer controller.Finish()
mockCW := mockcloudwatch.NewMockCloudWatchAPI(controller)
mockCW := mocks.NewMockCloudWatchAPI(controller)
mockCW.EXPECT().PutMetricData(fuzzy(&cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{{
Dimensions: []*cloudwatch.Dimension{{
Expand Down Expand Up @@ -75,7 +75,7 @@ func TestCloudWatchReporterReportsActiveHundredPercent(t *testing.T) {
defer testCtxCancel()
controller := gomock.NewController(t)
defer controller.Finish()
mockCW := mockcloudwatch.NewMockCloudWatchAPI(controller)
mockCW := mocks.NewMockCloudWatchAPI(controller)
mockCW.EXPECT().PutMetricData(fuzzy(&cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{{
Dimensions: []*cloudwatch.Dimension{{
Expand All @@ -99,7 +99,7 @@ func TestCloudWatchReporterReportsActiveOneHundredPercentWhenPausedForever(t *te
defer testCtxCancel()
controller := gomock.NewController(t)
defer controller.Finish()
mockCW := mockcloudwatch.NewMockCloudWatchAPI(controller)
mockCW := mocks.NewMockCloudWatchAPI(controller)
mockCW.EXPECT().PutMetricData(fuzzy(&cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{{
Dimensions: []*cloudwatch.Dimension{{
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestCloudWatchReporterReportsActiveOnehundredPercentWhenPaused(t *testing.T
defer testCtxCancel()
controller := gomock.NewController(t)
defer controller.Finish()
mockCW := mockcloudwatch.NewMockCloudWatchAPI(controller)
mockCW := mocks.NewMockCloudWatchAPI(controller)
mockCW.EXPECT().PutMetricData(fuzzy(&cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{{
Dimensions: []*cloudwatch.Dimension{{
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestCloudWatchReporterReportsActiveFiftyPercentWhenPaused(t *testing.T) {
defer testCtxCancel()
controller := gomock.NewController(t)
defer controller.Finish()
mockCW := mockcloudwatch.NewMockCloudWatchAPI(controller)
mockCW := mocks.NewMockCloudWatchAPI(controller)
mockCW.EXPECT().PutMetricData(fuzzy(&cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{{
Dimensions: []*cloudwatch.Dimension{{
Expand Down
Loading

0 comments on commit fcf3680

Please sign in to comment.