forked from algorand/java-algorand-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_integration_tests.sh
executable file
·79 lines (64 loc) · 1.94 KB
/
run_integration_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
set -e
rootdir=`dirname $0`
pushd $rootdir
SKIP_TEST_CONTAINER=0
UPDATE_FEATURE_FILES_ONLY=0
TEST_BRANCH=develop
function help {
echo "Options:"
echo " -local skip launching the test container."
echo " -feature-only don't bring up test environment or launch test container."
echo " -test-branch install feature files from this branch instead of the default branch."
}
function my_exit {
popd
exit $1
}
while [ "$1" != "" ]; do
case "$1" in
-local)
SKIP_TEST_CONTAINER=1
;;
-feature-only)
UPDATE_FEATURE_FILES_ONLY=1
;;
-test-branch)
shift
TEST_BRANCH=$1
;;
*)
echo "Unknown option $1"
help
my_exit 0
;;
esac
shift
done
# Reset test harness
rm -rf test-harness
git clone --single-branch --branch ${TEST_BRANCH} https://github.com/algorand/algorand-sdk-testing.git test-harness
## Copy feature files into the project resources
rm -rf src/test/resources/com/algorand/algosdk/integration
rm -rf src/test/resources/com/algorand/algosdk/unit
mkdir -p src/test/resources/com/algorand/algosdk/integration
mkdir -p src/test/resources/com/algorand/algosdk/unit
# These are too tightly coupled with the integration tests.
mv test-harness/features/unit/offline.feature test-harness/features/integration/
cp -r test-harness/features/integration/* src/test/resources/com/algorand/algosdk/integration
cp -r test-harness/features/unit/* src/test/resources/com/algorand/algosdk/unit
if [ "${UPDATE_FEATURE_FILES_ONLY}" == "1" ]; then
my_exit 1
fi
# Start test harness environment
./test-harness/scripts/up.sh
if [ "${SKIP_TEST_CONTAINER}" == "1" ]; then
my_exit 1
fi
# Build SDK testing environment
docker build -t java-sdk-testing -f Dockerfile "$(pwd)"
# Launch SDK testing
docker run -it \
--network host \
java-sdk-testing:latest
my_exit 0