Skip to content

Commit

Permalink
Check in mocks, don't re-generate them for each test. (#27)
Browse files Browse the repository at this point in the history
* Check in mocks, don't re-generate them for each test.

Signed-off-by: Jake Sanders <jsand@google.com>
  • Loading branch information
dekkagaijin committed Feb 17, 2018
1 parent b191933 commit a22800e
Show file tree
Hide file tree
Showing 15 changed files with 1,257 additions and 12 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,7 +1,6 @@
.gitignore~
.project
bin
mock
bazel*
*/test_config.json
*/test_credential_store.json
Expand Down
19 changes: 8 additions & 11 deletions Makefile
Expand Up @@ -12,21 +12,18 @@ all: clean bin
deps:
@go get -u -t ./...

testdeps:
@go get -u -t ./...
@go get -u github.com/golang/mock/gomock
@go get -u github.com/golang/mock/mockgen

bin: deps
@go build -i -o ${OUT_DIR}/${BINARY_FILENAME} main.go
@echo Binary created: ${OUT_DIR}/${BINARY_FILENAME}

clean:
@rm -rf ${OUT_DIR}
@rm -rf ${MOCK_DIR}
@go clean

# This re-generates the mocks using mockgen. Use this if tests don't compile due to type errors with
# the existing mocks.
mocks:
@go get -u github.com/golang/mock/mockgen
@rm -rf ${MOCK_DIR}
@mkdir -p ${MOCK_DIR}/mock_store
@mkdir -p ${MOCK_DIR}/mock_config
Expand All @@ -40,16 +37,16 @@ mocks:
@find ${MOCK_DIR} -name '*.go' -exec sed -i.bak -e 's,github.com/GoogleCloudPlatform/docker-credential-gcr/vendor/,,g' {} \;
@find ${MOCK_DIR} -name '*.go.bak' -exec rm {} \;

test: clean testdeps mocks bin
test: clean deps bin
@go test -timeout 10s -v -tags="unit integration surface" ./...

unit-tests: testdeps mocks
unit-tests: deps
@go test -timeout 10s -v -tags=unit ./...

integration-tests: testdeps
integration-tests: deps
@go test -timeout 10s -v -tags=integration ./...

surface-tests: deps testdeps bin
surface-tests: deps bin
@go test -timeout 10s -v -tags=surface ./...

vet:
Expand All @@ -69,4 +66,4 @@ fix:

pretty: fmt fix

presubmit: deps testdeps criticism pretty test
presubmit: deps criticism pretty bin test
50 changes: 50 additions & 0 deletions mock/mock_cmd/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions mock/mock_config/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 123 additions & 0 deletions mock/mock_store/mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions vendor/github.com/golang/mock/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions vendor/github.com/golang/mock/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/golang/mock/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a22800e

Please sign in to comment.