Skip to content

Commit 71d9603

Browse files
authored
test elasticsearch and mongodb datasets on macOS (#1224)
* 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
1 parent 7993605 commit 71d9603

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env:
1414
jobs:
1515
lint:
1616
name: Lint
17-
runs-on: ubuntu-18.04
17+
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Run Lint Script for Bazel/Pyupgrade/Black/Clang
@@ -196,6 +196,8 @@ jobs:
196196
bash -x -e tests/test_pubsub/pubsub_test.sh
197197
bash -x -e tests/test_aws/aws_test.sh
198198
bash -x -e tests/test_pulsar/pulsar_test.sh
199+
bash -x -e tests/test_elasticsearch/elasticsearch_test.sh start
200+
bash -x -e tests/test_mongodb/mongodb_test.sh start
199201
- name: Install ${{ matrix.python }} macOS
200202
run: |
201203
set -x -e

tests/test_elasticsearch/elasticsearch_test.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,23 @@ docker run -d --rm --name=tfio-elasticsearch \
4343
--ulimit memlock=-1:-1 \
4444
${ELASTICSEARCH_IMAGE}
4545

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

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

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

6365
echo ""

tests/test_mongodb/mongodb_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ docker run --rm -d -p 27017-27019:27017-27019 --name tfio-mongodb \
3535
echo ""
3636
echo "Waiting for mongodb to be up and running..."
3737
echo ""
38-
sleep 20
38+
sleep 60
3939

4040
elif [ "$action" == "stop" ]; then
4141
echo ""

0 commit comments

Comments
 (0)