Merge pull request #2742 from coolo/split_tests

CI: Split the tests in multiple runs
This commit is contained in:
Stephan Kulow 2022-03-07 19:53:21 +01:00 committed by GitHub
commit 0e859719b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 1 deletions

View File

@ -12,6 +12,10 @@ jobs:
tests:
timeout-minutes: 40
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ci_node_index: [Long1,Long2,Rest]
steps:
- name: Checkout
@ -22,6 +26,12 @@ jobs:
- name: Run tests
run: docker-compose -f dist/ci/docker-compose.yml run test
env:
# Specifies how many jobs you would like to run in parallel,
# used for partitioning
CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
# Use the index from matrix as an environment variable
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
- name: Submit coverage report to Codecov
uses: codecov/codecov-action@v1.5.2

View File

@ -13,7 +13,22 @@ until curl http://api:3000/about 2>/dev/null ; do
done
cd /code
ci_node=$1
for file in tests/*_tests.py; do
if test -n "$ci_node"; then
if test "$ci_node" == "Rest"; then
if grep -q '# CI-Node' $file; then
echo "Skipping $file in 'Rest'"
continue
fi
else
if ! grep -q "# CI-Node: $ci_node" $file; then
continue
fi
fi
fi
if ! test -f /code/.without-coverage; then
COVER_ARGS="--cov=. --cov-append --cov-report=xml"
else

View File

@ -48,7 +48,7 @@ services:
depends_on:
- api
- smtp
command: /code/dist/ci/docker-compose-test.sh
command: /code/dist/ci/docker-compose-test.sh ${CI_NODE_INDEX}
cap_add:
- SYS_PTRACE
flaker:

View File

@ -8,6 +8,8 @@ from osclib.core import package_list
from mock import MagicMock
from . import OBSLocal
# CI-Node: Long2
class TestAccept(unittest.TestCase):

View File

@ -2,6 +2,8 @@ import osc.core
from osclib.core import attribute_value_delete, attribute_value_save
from . import OBSLocal
# CI-Node: Long1
class TestApiCalls(OBSLocal.TestCase):
"""

View File

@ -18,6 +18,7 @@ FACTORY_MAINTAINERS = 'group:factory-maintainers'
# Inherit from OBSLocal.Testcase since it provides many commodity methods for testing against
# a local testing instance of OBS
# CI-Node: Long1
class TestCheckSource(OBSLocal.TestCase):

View File

@ -20,6 +20,8 @@ import time
import yaml
from . import OBSLocal
# CI-Node: Long2
class TestOrigin(OBSLocal.TestCase):
script = './origin-manager.py'

View File

@ -11,6 +11,8 @@ from lxml import etree as ET
from mock import MagicMock
from . import OBSLocal
# CI-Node: Long1
class TestSelect(OBSLocal.TestCase):