Skip to content

Commit ad159a1

Browse files
committed
Refactored CI testing to run on http as well
Signed-off-by: Roger Aiudi <[email protected]>
1 parent 92c4ee9 commit ad159a1

File tree

5 files changed

+60
-38
lines changed

5 files changed

+60
-38
lines changed

.dockerignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**.py[coi]
2+
*.egg-info/
3+
.coverage
4+
.tox/
5+
build/
6+
coverage/
7+
dist/
8+
doc/build/
9+
venv*/
10+
.idea

.github/actions/test/Dockerfile

-8
This file was deleted.

.github/actions/test/entrypoint.sh

-29
This file was deleted.

.github/workflows/tests.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
push:
66
paths:
77
- '**.py'
8+
- '.github/workflows/tests.yml'
9+
- 'docker-test.sh'
810
schedule:
911
# Test master every Saturday at midnight to verify dependencies
1012
- cron: '0 0 * * 6'
@@ -29,13 +31,16 @@ jobs:
2931
name: Test
3032
needs: flake8
3133
runs-on: ubuntu-latest
34+
container: aiudirog/aiohappybase-test-env:latest
3235
strategy:
3336
matrix:
3437
python: ['3.6', '3.7', '3.8', '3.9']
38+
client: ['socket', 'http']
3539
steps:
3640
- uses: actions/checkout@v1
3741
- name: Run Tests
38-
uses: ./.github/actions/test
3942
env:
4043
PYTHON_VERSION: ${{ matrix.python }}
44+
AIOHAPPYBASE_CLIENT: ${{ matrix.client }}
4145
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
46+
run: ./docker-test.sh

docker-test.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
5+
PYTHON=/usr/bin/python${PYTHON_VERSION}
6+
7+
${PYTHON} -m pip install -U -r test-requirements.txt
8+
9+
wait_hbase() {
10+
# Wait for thrift port to bind
11+
while ! netstat -tna | grep 'LISTEN\>' | grep -q ':9090\>'; do sleep 1; done
12+
sleep 1 # Give it a little extra time
13+
}
14+
15+
if [ "${CODECOV_TOKEN}" != "" ]; then
16+
${PYTHON} -m pip install coverage codecov
17+
18+
run_tests() {
19+
${PYTHON} -m coverage run -m pytest
20+
${PYTHON} -m coverage xml
21+
${PYTHON} -m codecov --token=${CODECOV_TOKEN}
22+
}
23+
else
24+
run_tests() { ${PYTHON} -m pytest; }
25+
fi
26+
27+
if [ "$AIOHAPPYBASE_CLIENT" == "http" ]; then
28+
ENABLE_HTTP=$(echo "<property><name>hbase.regionserver.thrift.http</name><value>true</value></property>" | sed 's/\//\\\//g')
29+
sed -i "/<\/configuration>/ s/.*/${ENABLE_HTTP}\n&/" /opt/hbase/conf/hbase-site.xml
30+
fi
31+
32+
/opt/hbase-server &>/dev/null & # It's already got its own logs
33+
34+
wait_hbase
35+
36+
HBASE_PID=$!
37+
38+
# Run tests for latest HBase compat
39+
export AIOHAPPYBASE_COMPAT=0.98
40+
run_tests
41+
42+
# Run tests for min HBase compat
43+
export AIOHAPPYBASE_COMPAT=0.90
44+
run_tests

0 commit comments

Comments
 (0)