Merge pull request #2 from mwinkens/github-ready #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
test_case: | |
- name: Test ram at load at 100% | |
TEST_SCRIPT: integrationtests/test_ram_check | |
TEST_RESULT: 100% | |
- name: Test ram at 85% full | |
TEST_SCRIPT: integrationtests/test_ram_check_85 | |
TEST_RESULT: 25% | |
- name: Test ram critical | |
TEST_SCRIPT: integrationtests/test_ram_check_critical | |
TEST_RESULT: 0% | |
- name: Test load critical | |
TEST_SCRIPT: integrationtests/test_load_check_critical | |
TEST_RESULT: 1% | |
- name: Test load at 0% | |
TEST_SCRIPT: integrationtests/test_load_check | |
TEST_RESULT: 100% | |
- name: Test load at 75% | |
TEST_SCRIPT: integrationtests/test_load_check_75 | |
TEST_RESULT: 25% | |
- name: Test load at 100% | |
TEST_SCRIPT: integrationtests/test_load_check_100 | |
TEST_RESULT: 10% | |
- name: Test buildins | |
TEST_SCRIPT: integrationtests/test_build_in_checks | |
TEST_RESULT: 100% | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Checkout submodules | |
run: git submodule update --init | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y gcc build-essential linux-headers-$(uname -r) git | |
pip install -r buildins/requirements.txt | |
- name: Start server | |
run: python agent.py -host 0.0.0.0 -p 3000 ${{ matrix.test_case.TEST_SCRIPT }} & | |
- name: Wait for server to boot up | |
run: sleep 5 | |
- name: Run tests | |
run: | | |
python tests/test_client.py > result.out | |
cat result.out | |
if [ "$(cat result.out)" = "${{ matrix.test_case.TEST_RESULT }}" ] || [ "${{ matrix.test_case.TEST_RESULT }}" = "any" ]; then | |
exit 0 | |
else | |
exit 1 | |
fi |