From 92c4fb30746ac72845ff805570f1eefe8eb6cf8b Mon Sep 17 00:00:00 2001 From: Conor Mongey Date: Tue, 19 Feb 2019 01:25:56 +0000 Subject: [PATCH] Run gotest --- .circleci/config.yml | 22 +++++++++++++++------- .gitignore | 1 + GNUmakefile | 12 ++++++++++++ plugin/backend_test.go | 4 ++++ 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 .gitignore create mode 100644 GNUmakefile diff --git a/.circleci/config.yml b/.circleci/config.yml index a5b9629..3d51a3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,18 @@ version: 2 jobs: build: + working_directory: /go/src/github.com/Mongey/vault-plugin-secrets-kafka + docker: + - image: circleci/golang:1.11 + environment: + TEST_RESULTS: /tmp/test-results + steps: + - checkout + - run: make build + - store_artifacts: + path: /go/src/github.com/Mongey/vault-plugin-secrets-kafka/vault-plugin-secrets-kafka + destination: vault-plugin-secrets-kafka + test: working_directory: /go/src/github.com/Mongey/vault-plugin-secrets-kafka docker: - image: circleci/golang:1.11 @@ -18,23 +30,19 @@ jobs: KAFKA_LOG_SEGMENT_BYTES: 1234 steps: - checkout - - run: go build - - store_artifacts: - path: /go/src/github.com/Mongey/vault-plugin-secrets-kafka/vault-plugin-secrets-kafka - destination: vault-plugin-secrets-kafka - - run: make test - run: go get github.com/jstemmer/go-junit-report - run: mkdir -p $TEST_RESULTS - run: name: Run Tests command: | trap "go-junit-report <${TEST_RESULTS}/go-test.out > ${TEST_RESULTS}/go-test-report.xml" EXIT - make testacc| tee ${TEST_RESULTS}/go-test.out + make test| tee ${TEST_RESULTS}/go-test.out - store_test_results: path: /tmp/test-results workflows: version: 2 - build: + build-and-test: jobs: - build + - test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d830636 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vault-plugin-secrets-kafka diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..eac97b5 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,12 @@ +TEST?=$$(go list ./... |grep -v 'vendor') +GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) +default: build + +build: + go build . + +test: + go test -i $(TEST) || exit 1 + echo $(TEST) | \ + xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4 + diff --git a/plugin/backend_test.go b/plugin/backend_test.go index 0e683c8..34a5fba 100644 --- a/plugin/backend_test.go +++ b/plugin/backend_test.go @@ -34,8 +34,12 @@ func testAccStepRole(t *testing.T, role string) logicaltest.TestStep { }, } } + func testAccStepConfig(t *testing.T, uri string) logicaltest.TestStep { password := os.Getenv("KAFKA_ROOT_CERTIFICATE") + if password == "" { + t.Fatal("KAFKA_ROOT_CERTIFICATE must be set in the env") + } return logicaltest.TestStep{ Operation: logical.UpdateOperation,