-
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 #46 from chainifynet/feature/refactor
Refactor and Support KMS MRK
- Loading branch information
Showing
118 changed files
with
10,058 additions
and
2,030 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ e2e/testutils/cli.go | |
e2e/testutils/helpers.go | ||
e2e/testutils/hits.go | ||
e2e/testutils/setup.go | ||
mocks/ |
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 |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
*.test | ||
*.out | ||
go.work | ||
mocks/ | ||
coverage.html | ||
|
||
# MacOS | ||
tmp/ | ||
|
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,43 @@ | ||
with-expecter: true | ||
filename: "{{.InterfaceName}}_mock.go" | ||
tags: "mocks" | ||
packages: | ||
github.com/chainifynet/aws-encryption-sdk-go/pkg/model: | ||
config: | ||
tags: "mocks" | ||
interfaces: | ||
KMSClient: | ||
KMSClientFactory: | ||
BaseKeyProvider: | ||
config: | ||
mockname: "MockKeyProvider" | ||
filename: "KeyProvider_mock.go" | ||
MasterKeyProvider: | ||
MasterKeyBase: | ||
MasterKey: | ||
MasterKeyFactory: | ||
Key: | ||
config: | ||
mockname: "MockKey" | ||
filename: "Key_mock.go" | ||
DataKeyI: | ||
config: | ||
mockname: "MockDataKey" | ||
filename: "DataKey_mock.go" | ||
EncryptedDataKeyI: | ||
config: | ||
mockname: "MockEncryptedDataKey" | ||
filename: "EncryptedDataKey_mock.go" | ||
CryptoMaterialsManager: | ||
DecryptionMaterial: | ||
EncryptionMaterial: | ||
Wrapper: | ||
github.com/chainifynet/aws-encryption-sdk-go/pkg/utils/encryption: | ||
interfaces: | ||
GcmBase: | ||
config: | ||
mockname: "MockEncrypter" | ||
filename: "Encrypter_mock.go" | ||
github.com/chainifynet/aws-encryption-sdk-go/pkg/utils/rand: | ||
interfaces: | ||
RandomGenerator: |
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,8 +1,8 @@ | ||
SHELL=/usr/bin/env bash | ||
|
||
UNIT_TEST_TAGS= | ||
BUILD_TAGS=-tags "example,codegen,integration,slow" | ||
CI_TAGS="example,codegen,integration" | ||
BUILD_TAGS=-tags "example,mocks,codegen,integration,slow" | ||
CI_TAGS="example,mocks,codegen,integration" | ||
|
||
GOTESTSUM_FMT="github-actions" | ||
#GOTESTSUM_FMT="standard-verbose" | ||
|
@@ -14,22 +14,31 @@ SDK_PKGS=./pkg/... | |
RUN_NONE=-run NOTHING | ||
RUN_INTEG=-run '^Test_Integration_' | ||
|
||
.PHONY: all deps mocks vet lint lint-ci lint-local unit | ||
.PHONY: all deps mocks mocks-build-tag vet lint lint-ci lint-local unit | ||
all: unit | ||
|
||
deps: | ||
@echo "Installing dependencies" | ||
@go mod download -x all | ||
@go install gotest.tools/gotestsum@latest | ||
@go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
@go install github.com/vektra/mockery/[email protected] | ||
@#go get github.com/stretchr/testify/[email protected] | ||
@#go install github.com/vektra/mockery/[email protected] | ||
|
||
mocks: | ||
@echo "Generating mocks" | ||
@#mockery --all --keeptree --case=underscore --output=./test/mocks | ||
@mockery --tags=mocks | ||
@$(MAKE) mocks-build-tag | ||
|
||
lint: vet lint-ci | ||
mocks-build-tag: | ||
@echo "Adding mocks build tag to mock files" | ||
@if [ "$$(uname)" = "Darwin" ]; then \ | ||
find ./mocks/ -name '*_mock.go' -exec gsed -i '/^package/ i //go:build mocks' {} +; \ | ||
else \ | ||
find ./mocks/ -name '*_mock.go' -exec sed -i '/^package/ i //go:build mocks' {} +; \ | ||
fi | ||
|
||
lint: mocks vet lint-ci | ||
|
||
lint-ci: | ||
@echo "Running golangci-lint" | ||
|
@@ -103,3 +112,18 @@ e2e-test-full: | |
e2e-test-slow: | ||
@echo "Running very slow e2e tests" | ||
@gotestsum -f testname -- -timeout=30m -tags "integration,slow" ${RUN_INTEG} ./test/e2e/... | ||
|
||
## | ||
# Coverage | ||
## | ||
|
||
.PHONY: test-cover cover-html | ||
|
||
test-cover: | ||
@#CGO_ENABLED=0 go test -count=1 -coverpkg=./... -covermode=atomic -coverprofile coverage.out ./... | ||
@CGO_ENABLED=0 go test -tags ${CI_TAGS} -count=1 -coverpkg=./... -covermode=atomic -coverprofile coverage.out ./pkg/... | ||
@grep -v -E -f .covignore coverage.out > coverage.filtered.out | ||
@mv coverage.filtered.out coverage.out | ||
|
||
cover-html: | ||
@go tool cover -html=coverage.out -o coverage.html |
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
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
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
Oops, something went wrong.