Skip to content

Commit 9ffd516

Browse files
authored
Merge pull request #469 from kbase/develop
Release 0.2.5: SAM-119, SAM-209, SAM-236
2 parents 951122f + 0fb836e commit 9ffd516

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2302
-1228
lines changed

.github/workflows/non_sdk_test.yml

Lines changed: 9 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -24,80 +24,20 @@ jobs:
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626

27-
- name: Set up test environment
28-
if: "!contains(github.event.head_commit.message, 'skip ci')"
29-
shell: bash
30-
env:
31-
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
32-
MONGODB_VER: mongodb-linux-x86_64-3.6.16
33-
ARANGODB_VER: 3.5.1
34-
ARANGODB_V: 35
35-
KAFKA_VER: 2.8.1
36-
SCALA_VER: 2.12
37-
run: |
38-
# upgrade and update
39-
apt update && apt upgrade
40-
# Download necessary components for testing
41-
# mongo is only a test dependency, no point in matrixing it
42-
cd ..
43-
wget http://fastdl.mongodb.org/linux/$MONGODB_VER.tgz
44-
# file may be gzipped over transfer
45-
gzip -d $MONGODB_VER.tgz
46-
tar xf $MONGODB_VER.tar
47-
export MONGOD=`pwd`/$MONGODB_VER/bin/mongod
48-
cd -
49-
echo "Done with Mongo"
50-
51-
# arango
52-
cd ..
53-
curl -O https://download.arangodb.com/arangodb$ARANGODB_V/Community/Linux/arangodb3-linux-$ARANGODB_VER.tar.gz
54-
tar -xf arangodb3-linux-$ARANGODB_VER.tar.gz
55-
export ARANGO_EXE=$(pwd)/arangodb3-$ARANGODB_VER/usr/sbin/arangod
56-
export ARANGO_JS=$(pwd)/arangodb3-$ARANGODB_VER/usr/share/arangodb3/js/
57-
cd -
58-
echo "Done with Arango"
59-
60-
# kafka
61-
cd ..
62-
curl -O http://mirror.metrocast.net/apache/kafka/$KAFKA_VER/kafka_$SCALA_VER-$KAFKA_VER.tgz
63-
tar -xzf kafka_$SCALA_VER-$KAFKA_VER.tgz
64-
export KAFKA_BIN_DIR=$(pwd)/kafka_$SCALA_VER-$KAFKA_VER/bin
65-
cd -
66-
echo "Done with Kafka"
27+
- name: Install pipenv
28+
run: pip install -r requirements.txt
6729

68-
# jars
69-
cd ..
70-
git clone https://github.com/kbase/jars
71-
export JARS=$(pwd)/jars/lib/jars
72-
cd -
73-
echo "Done with Jars"
74-
75-
# copy to test.cfg file
76-
cd test
77-
cp test.cfg.example test.cfg
78-
sed -i "s#^test.jars.dir=.*#test.jars.dir=$JARS#" test.cfg
79-
sed -i "s#^test.temp.dir=.*#test.temp.dir=temp_test_dir#" test.cfg
80-
sed -i "s#^test.arango.exe.*#test.arango.exe=$ARANGO_EXE#" test.cfg
81-
sed -i "s#^test.arango.js.*#test.arango.js=$ARANGO_JS#" test.cfg
82-
sed -i "s#^test.mongo.exe.*#test.mongo.exe=$MONGOD#" test.cfg
83-
sed -i "s#^test.kafka.bin.dir.*#test.kafka.bin.dir=$KAFKA_BIN_DIR#" test.cfg
84-
sed -i "s#^test.mongo.wired_tiger.*#test.mongo.wired_tiger=true#" test.cfg
85-
cat test.cfg
86-
cd -
87-
88-
- name: Install Python dependencies
30+
- name: Set up for tests
31+
if: "!contains(github.event.head_commit.message, 'skip ci')"
8932
shell: bash
9033
run: |
91-
pip install --upgrade pip
92-
pip install -r requirements.txt
34+
make test-setup
9335
9436
- name: Run tests
9537
shell: bash
9638
run: |
97-
echo "Create fake deployment config"
98-
echo "[SampleService]" > service.cfg
99-
echo "srv_wiz_url = https://ci.kbase.us/services/service_wizard" >> service.cfg
100-
export KB_DEPLOYMENT_CONFIG=`pwd`/service.cfg
101-
pipenv install --dev
102-
pipenv run make test-sdkless
39+
make test
10340
41+
- name: Coverage Summary
42+
run: |
43+
make coverage-summary

.gitignore

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
1-
.DS_Store
2-
.idea
3-
test/test.cfg
4-
test_local
1+
# Development
52
__pycache__
63
.vscode
74
deploy.cfg
5+
lib/SampleService/SampleServiceImpl.py.bak*
6+
test/test.cfg.bak
7+
/_temp
8+
.mypy_cache
9+
.pytest_cache
10+
11+
# Testing
12+
test/test.cfg
13+
test_local
814
.coverage
915
test/test_temp/
10-
lib/SampleService/SampleServiceImpl.py.bak*
16+
test/bin/jars
17+
test/bin/mongo
18+
test/bin/arangodb
19+
test/bin/kafka
20+
test/bin/temp
21+
htmlcov/
22+
cov_profile.lcov
23+
temp_test_dir
24+
mongo.log
25+
26+
# IDE
27+
.vscode
28+
.idea
29+
30+
# OS
31+
.DS_Store

Makefile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ compile:
3838
--out . \
3939
--html \
4040

41-
test:
42-
echo Use test-sdkless
41+
test: test-sdkless coverage-reports
4342

4443
test-sdkless:
45-
# TODO flake8 and bandit
46-
# TODO check tests run with kb-sdk test - will need to install mongo and update config
47-
MYPYPATH=$(MAKEFILE_DIR)/$(LIB_DIR) mypy --namespace-packages $(LIB_DIR)/$(SERVICE_CAPS)/core $(TEST_DIR)
48-
PYTHONPATH=$(PYPATH) SAMPLESERV_TEST_FILE=$(TSTFL) pytest --verbose --cov $(LIB_DIR)/$(SERVICE_CAPS) --cov-config=$(TEST_DIR)/coveragerc $(TEST_SPEC)
49-
# to print test output immediately: --capture=tee-sys
44+
# TODO flake8 and bandit
45+
# TODO check tests run with kb-sdk test - will need to install mongo and update config
46+
MYPYPATH=$(MAKEFILE_DIR)/$(LIB_DIR) pipenv run mypy --namespace-packages $(LIB_DIR)/$(SERVICE_CAPS)/core $(TEST_DIR)
47+
PYTHONPATH=$(PYPATH) SAMPLESERV_TEST_FILE=$(TSTFL) pipenv run pytest --verbose --cov $(LIB_DIR)/$(SERVICE_CAPS) --cov-config=$(TEST_DIR)/coveragerc $(TEST_SPEC)
48+
# to print test output immediately: --capture=tee-sys
5049

5150
clean:
5251
rm -rfv $(LBIN_DIR)
@@ -58,3 +57,18 @@ host-start-dev-server:
5857

5958
host-stop-dev-server:
6059
source scripts/dev-server-env.sh && sh scripts/stop-dev-server.sh
60+
61+
# Test support
62+
63+
test-setup:
64+
bash test/scripts/test-setup.sh
65+
66+
coverage-reports:
67+
@echo "Creating html coverage report"
68+
pipenv run coverage html
69+
@echo "Converting coverage to lcov"
70+
pipenv run coverage lcov --data-file .coverage -o cov_profile.lcov
71+
72+
coverage-summary:
73+
@echo "Coverage summary:"
74+
pipenv run coverage report

Pipfile

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,37 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
pytest = "*"
8-
pytest-cov = "*"
9-
mypy = "*"
10-
coveralls = "*"
11-
flake8 = "*"
12-
pymongo = "*"
13-
semver = "*"
14-
ipython = "*"
15-
black = "*"
7+
pytest = "==7.1.2"
8+
pytest-cov = "==3.0.0"
9+
mypy = "==0.942"
10+
coveralls = "==3.3.1"
11+
flake8 = "==4.0.1"
12+
semver = "==2.13.0"
13+
coverage = "==6.3.2"
14+
pymongo = "==4.1.1"
1615

1716
[packages]
1817
python-arango = "==5.0.0"
1918
jsonrpcbase = "==0.2.0"
20-
apscheduler = "==3.6.3"
19+
apscheduler = "==3.9.1"
2120
maps = "==5.1.1"
22-
requests = "==2.22.0"
23-
cacheout = "==0.11.2"
24-
pyyaml = "==5.4"
21+
requests = "==2.27.1"
22+
cacheout = "==0.13.1"
23+
pyyaml = "==6.0"
2524
jsonschema = "==3.2.0"
26-
pint = "==0.10.1"
27-
python-ranges = "==0.1.3"
28-
pygtrie = "==2.3.2"
29-
jinja2 = "==2.11.3"
30-
gevent = "==20.5.0"
31-
gunicorn = "==20.0.4"
32-
kafka-python = "==2.0.1"
33-
greenlet = "==0.4.16"
34-
typing-extensions = "*"
35-
types-pyyaml = "*"
36-
types-requests = "*"
37-
pipenv = "*"
38-
shell = "*"
25+
# hold pint back to 0.17 - requires code changes at 0.18
26+
pint = "==0.17"
27+
python-ranges = "==0.2.0"
28+
pygtrie = "==2.4.2"
29+
jinja2 = "==3.1.1"
30+
gevent = "==21.12.0"
31+
gunicorn = "==20.1.0"
32+
kafka-python = "==2.0.2"
33+
greenlet = "==1.1.2"
34+
typing-extensions = "==4.2.0"
35+
types-pyyaml = "==6.0.7"
36+
types-requests = "==2.27.20"
37+
shell = "==1.0.1"
3938

4039
[requires]
4140
python_version = "3.7"

0 commit comments

Comments
 (0)