diff --git a/.github/workflows/bookkeeper.yml b/.github/workflows/bookkeeper.yml index 4669727b..b02341dc 100644 --- a/.github/workflows/bookkeeper.yml +++ b/.github/workflows/bookkeeper.yml @@ -25,7 +25,7 @@ jobs: - name: Check bookKeeper service run: | - ./test/script/check.sh bookieHTTP + ./test/script/check.sh HTTP - name: Write dummy data run: | diff --git a/.github/workflows/cluster.yml b/.github/workflows/cluster.yml new file mode 100644 index 00000000..0b640295 --- /dev/null +++ b/.github/workflows/cluster.yml @@ -0,0 +1,42 @@ +name: Pulsarctl Pulsar Cluster Tests Check +on: [pull_request] +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.12 + uses: actions/setup-go@v1 + with: + go-version: 1.12 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Run Pulsar cluster service + run: | + pushd test/docker + docker-compose -f pulsar-cluster.yml up -d + popd + + - name: Check Pulsar cluster service + run: | + ./test/script/check.sh HTTP + + - name: Preapare for functions, sources, and sinks + run: | + wget -P test/sources https://archive.apache.org/dist/pulsar/pulsar-2.4.0/connectors/pulsar-io-kafka-2.4.0.nar + wget -P test/sinks https://archive.apache.org/dist/pulsar/pulsar-2.4.0/connectors/pulsar-io-jdbc-2.4.0.nar + docker cp test/sources/pulsar-io-kafka-2.4.0.nar broker:/pulsar + docker cp test/sinks/pulsar-io-jdbc-2.4.0.nar broker:/pulsar + docker cp test/sources/kafkaSourceConfig.yaml broker:/pulsar/conf + docker cp test/sinks/mysql-jdbc-sink.yaml broker:/pulsar/conf + docker cp broker:/pulsar/examples/api-examples.jar test/functions + + - name: Test + run: | + docker ps + go test -v $(go list ./... | grep -v bookkeeper | grep -v bkctl) diff --git a/test/docker/pulsar-cluster.yml b/test/docker/pulsar-cluster.yml new file mode 100644 index 00000000..c348c953 --- /dev/null +++ b/test/docker/pulsar-cluster.yml @@ -0,0 +1,66 @@ +version: '3' +services: + pulsar-zookeeper: + container_name: zookeeper + image: "apachepulsar/pulsar:latest" + hostname: pulsar-zookeeper + command: bin/pulsar zookeeper + + pulsar-proxy: + container_name: proxy + image: "apachepulsar/pulsar:latest" + hostname: pulsar-proxy + links: + - pulsar-zookeeper + depends_on: + - pulsar-zookeeper + environment: + - brokerServiceURL=pulsar://broker:6650 + - brokerWebServiceURL=http://broker:8080 + ports: + - "8080:8080" + command: > + sh -c "sleep 10 + && bin/apply-config-from-env.py conf/proxy.conf + && bin/pulsar proxy" + + pulsar-broker: + container_name: broker + image: "apachepulsar/pulsar:latest" + hostname: broker + links: + - pulsar-zookeeper + depends_on: + - pulsar-zookeeper + environment: + - zookeeperServers=pulsar-zookeeper:2181 + - clusterName=test + command: > + sh -c "sleep 10 + && bin/apply-config-from-env.py conf/broker.conf + && bin/pulsar broker" + + pulsar-bookie: + container_name: bookie + image: "apachepulsar/pulsar:latest" + hostname: bk + links: + - pulsar-zookeeper + depends_on: + - pulsar-zookeeper + environment: + - zkServers=pulsar-zookeeper:2181 + command: > + sh -c "sleep 10 + && bin/apply-config-from-env.py conf/bookkeeper.conf + && bin/pulsar bookie" + + pulsar-init: + container_name: pulsar-init + image: "apachepulsar/pulsar:latest" + links: + - pulsar-zookeeper + depends_on: + - pulsar-zookeeper + command: bin/pulsar initialize-cluster-metadata -c test -cs pulsar-zookeeper:2181 -uw pulsar-proxy:8080 -zk pulsar-zookeeper:2181 + diff --git a/test/script/check.sh b/test/script/check.sh index b30425eb..e588aaf6 100755 --- a/test/script/check.sh +++ b/test/script/check.sh @@ -3,7 +3,7 @@ # Waiting bookie HTTP service start up, if the bookie HTTP service does not # start up in 30 seconds, that means the bookie HTTP service is not start # up successfully. -function checkBookieHTTP() { +function HTTPService() { failed=0 until curl localhost:8080; do echo waiting service start... @@ -17,9 +17,9 @@ function checkBookieHTTP() { } case $1 in - bookieHTTP) checkBookieHTTP + HTTP) HTTPService ;; *) echo Which service you would like to check? - echo Available service: bookieHTTP + echo Available service: HTTP ;; esac \ No newline at end of file