Skip to content

Commit

Permalink
test elasticsearch and mongodb datasets on macOS (#1224)
Browse files Browse the repository at this point in the history
* test elasticsearch and mongodb datasets on macos

* switch to ubuntu-latest for lint checks

* increase wait time to setup elasticsearch

* increase timeout for test setup
  • Loading branch information
kvignesh1420 committed Dec 12, 2020
1 parent 7993605 commit 71d9603
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
jobs:
lint:
name: Lint
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Lint Script for Bazel/Pyupgrade/Black/Clang
Expand Down Expand Up @@ -196,6 +196,8 @@ jobs:
bash -x -e tests/test_pubsub/pubsub_test.sh
bash -x -e tests/test_aws/aws_test.sh
bash -x -e tests/test_pulsar/pulsar_test.sh
bash -x -e tests/test_elasticsearch/elasticsearch_test.sh start
bash -x -e tests/test_mongodb/mongodb_test.sh start
- name: Install ${{ matrix.python }} macOS
run: |
set -x -e
Expand Down
20 changes: 11 additions & 9 deletions tests/test_elasticsearch/elasticsearch_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,23 @@ docker run -d --rm --name=tfio-elasticsearch \
--ulimit memlock=-1:-1 \
${ELASTICSEARCH_IMAGE}

echo ""
echo "Waiting for the elasticsearch cluster to be up and running..."
echo ""
sleep 20
for i in {1..120}; do
RESPONSE=$(curl -w '%{http_code}' -H 'Authorization: Basic ZWxhc3RpYzpkZWZhdWx0X3Bhc3N3b3Jk' -so /dev/null -L localhost:9200/) || true
if [[ $RESPONSE == 200 ]]; then
echo "[$i] Accessed base endpoint successfully"
break
fi
echo "[$i] Access base endpoint failed: $RESPONSE, sleep for 1 second"
sleep 1
done

echo ""
echo "Checking the base REST-API endpoint..."
echo ""
# The Authorization header contains the base64 encoded value of "elastic:default_password"
# As per the environment variable set while starting the container.
curl -X GET localhost:9200/ --header 'Authorization: Basic ZWxhc3RpYzpkZWZhdWx0X3Bhc3N3b3Jk'

echo ""
echo "Checking the healthcheck REST-API endpoint..."
echo ""
# The Authorization header contains the base64 encoded value of "elastic:default_password"
# As per the environment variable set while starting the container.
curl -X GET localhost:9200/_cluster/health --header 'Authorization: Basic ZWxhc3RpYzpkZWZhdWx0X3Bhc3N3b3Jk'

echo ""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mongodb/mongodb_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ docker run --rm -d -p 27017-27019:27017-27019 --name tfio-mongodb \
echo ""
echo "Waiting for mongodb to be up and running..."
echo ""
sleep 20
sleep 60

elif [ "$action" == "stop" ]; then
echo ""
Expand Down

0 comments on commit 71d9603

Please sign in to comment.