Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test background hive server #409

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@ install:

# NOTE: mount all $GOPATH into container, then after build and test,
# $GOPATH/bin will have expected binaries.

# NOTE: When doing tests for hive, we must expose all ports that gohive client
# may need, like thrift ports, namenode ports, datanode ports etc:
# 10000,10002,8040,8042,9864,9866,9867,9870,8020. Then we start a simple http
# server on port 8899 using python, so that the docker container running SQLFlow
# test can know when the hive server becomes ready.

script:
- set -e
- ls -lah
- docker build -t sqlflow:latest -f Dockerfile .
- docker run --rm -v $GOPATH/src:/go/src -w /go/src/github.com/sql-machine-learning/sqlflow sqlflow:latest pre-commit run -a
- docker run --rm -v $GOPATH:/go -w /go/src/github.com/sql-machine-learning/sqlflow sqlflow:latest bash scripts/test.sh
- docker run --rm -v $GOPATH:/go -w /go/src/github.com/sql-machine-learning/sqlflow sqlflow/gohive:dev bash scripts/test_hive.sh
- docker run -d --name=hive -p 10000:10000 -p 10002:10002 -p 8040:8040 -p 8042:8042 -p 9864:9864 -p 9866:9866 -p 9867:9867 -p 9870:9870 -p 8020:8020 -p 8899:8899 sqlflow/gohive:dev python3 -m http.server 8899
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these very long commands into a shell script file so we could have a chance to write comments explaining like why we'd export ports like 10002, 8040, 9846, 9866, and 9867?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments in .traivs.yml

- docker run --rm -v $GOPATH:/go --net=host --entrypoint bash -w /go/src/github.com/sql-machine-learning/sqlflow sqlflow:latest scripts/test_hive.sh

deploy:
skip_cleanup: true
Expand Down
15 changes: 15 additions & 0 deletions scripts/test_hive.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash

# Wait until hive test server is ready, port 8899
# is a status port indicates the hive server container
# is ready, see .travis.yml for the details
while [ 1 ]
do
curl http://localhost:8899 2>/dev/null
if [ $? -eq 0 ]; then
break
else
echo "still waiting, hive server is not ready..."
sleep 5
fi
done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are switching back to sqlflow/sqlflow:latest, the following lines can be removed.

set -e
. /miniconda/etc/profile.d/conda.sh
source activate sqlflow-dev

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will clean up in next PR.

set -e
. /miniconda/etc/profile.d/conda.sh
source activate sqlflow-dev
Expand Down