You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/15 18:37:14 UTC
[pulsar-client-go] branch master updated: Added scripts to run unit
tests (#6)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git
The following commit(s) were added to refs/heads/master by this push:
new 94edfbf Added scripts to run unit tests (#6)
94edfbf is described below
commit 94edfbf121d60660b32cdf2ac5169d62c9686d51
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Wed May 15 11:37:09 2019 -0700
Added scripts to run unit tests (#6)
---
Dockerfile | 1 +
Dockerfile => docker-ci.sh | 19 ++++++++-----------
Dockerfile => run-ci.sh | 28 +++++++++++++++++-----------
3 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 1186f96..d7a3211 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -32,3 +32,4 @@ COPY integration-tests/standalone.conf /pulsar/conf
COPY integration-tests/client.conf /pulsar/conf
COPY pulsar-test-service-start.sh /pulsar/bin
COPY pulsar-test-service-stop.sh /pulsar/bin
+COPY run-ci.sh /pulsar/bin
diff --git a/Dockerfile b/docker-ci.sh
old mode 100644
new mode 100755
similarity index 64%
copy from Dockerfile
copy to docker-ci.sh
index 1186f96..81486cf
--- a/Dockerfile
+++ b/docker-ci.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -17,18 +18,14 @@
# under the License.
#
-FROM golang:1.12 as go
+set -e -x
-FROM apachepulsar/pulsar:latest
+SRC_DIR=$(git rev-parse --show-toplevel)
+cd ${SRC_DIR}
-COPY --from=go /usr/local/go /usr/local/go
-ENV PATH /root/go/bin:/usr/local/go/bin:$PATH
+IMAGE_NAME=pulsar-client-go-test:latest
-### Add test scripts
+docker build -t ${IMAGE_NAME} .
-COPY integration-tests/certs /pulsar/certs
-COPY integration-tests/tokens /pulsar/tokens
-COPY integration-tests/standalone.conf /pulsar/conf
-COPY integration-tests/client.conf /pulsar/conf
-COPY pulsar-test-service-start.sh /pulsar/bin
-COPY pulsar-test-service-stop.sh /pulsar/bin
+docker run -i -v ${PWD}:/pulsar-client-go ${IMAGE_NAME} \
+ bash -c "cd /pulsar-client-go && ./run-ci.sh"
\ No newline at end of file
diff --git a/Dockerfile b/run-ci.sh
old mode 100644
new mode 100755
similarity index 64%
copy from Dockerfile
copy to run-ci.sh
index 1186f96..1b863fe
--- a/Dockerfile
+++ b/run-ci.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -17,18 +18,23 @@
# under the License.
#
-FROM golang:1.12 as go
+set -e -x
-FROM apachepulsar/pulsar:latest
+export GOPATH=/
-COPY --from=go /usr/local/go /usr/local/go
-ENV PATH /root/go/bin:/usr/local/go/bin:$PATH
+# Install dependencies
+go mod download
-### Add test scripts
+# Basic compilation
+go build ./pulsar
+go build -o pulsar-perf ./perf
+
+./pulsar-test-service-start.sh
+
+# Run tests on the directories that contains any '*_test.go' file
+DIRS=`find ./pulsar -name '*_test.go' | xargs -n1 dirname | sort | uniq`
+go test -coverprofile=/tmp/coverage ${DIRS}
+go tool cover -html=/tmp/coverage -o coverage.html
+
+./pulsar-test-service-stop.sh
-COPY integration-tests/certs /pulsar/certs
-COPY integration-tests/tokens /pulsar/tokens
-COPY integration-tests/standalone.conf /pulsar/conf
-COPY integration-tests/client.conf /pulsar/conf
-COPY pulsar-test-service-start.sh /pulsar/bin
-COPY pulsar-test-service-stop.sh /pulsar/bin