-
Notifications
You must be signed in to change notification settings - Fork 44
/
unit_test.sh
executable file
·41 lines (35 loc) · 1.18 KB
/
unit_test.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
#!/bin/bash
# check python version
python3 --version
python3 -m venv .unit_test_venv
source .unit_test_venv/bin/activate
pip install --upgrade pip
pip install .
pip install -r requirements.txt
INSIGHTS_FILTERS_ENABLED=false INVENTORY_TOPIC=platform.inventory.host-ingress-p1 ACG_CONFIG=dev/cdappconfig.json pytest tests/ --junitxml=$WORKSPACE/artifacts/junit-unit_tests.xml
if [ $? != 0 ]; then
echo "Failed to run unit test"
exit 1
fi
git clone https://github.com/RedHatInsights/inventory-schemas.git
echo '---------------------------------'
echo ' Run the profile and schema check'
echo '---------------------------------'
for file in dev/test-archives/*; do
filename="$(basename "$file").tar.gz"
tar -zcf $filename "$file"
insights-run -p src/puptoo -f json $filename > output.json
insights-run -p src/puptoo $filename # this is to print the results in the test console
if [ $? != 0 ]; then
exit 1
fi
python dev/parse_json.py
python inventory-schemas/tools/simple-test/tester.py inventory-schemas/schemas/system_profile/v1.yaml output.json
if [ $? != 0 ]; then
exit 1
fi
rm $filename
rm -rf inventory-schemas
rm output.json
done
deactivate