Merge pull request #2742 from coolo/split_tests
CI: Split the tests in multiple runs
This commit is contained in:
commit
0e859719b2
10
.github/workflows/ci-test.yml
vendored
10
.github/workflows/ci-test.yml
vendored
@ -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
|
||||
|
15
dist/ci/docker-compose-test.sh
vendored
15
dist/ci/docker-compose-test.sh
vendored
@ -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
|
||||
|
2
dist/ci/docker-compose.yml
vendored
2
dist/ci/docker-compose.yml
vendored
@ -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:
|
||||
|
@ -8,6 +8,8 @@ from osclib.core import package_list
|
||||
from mock import MagicMock
|
||||
from . import OBSLocal
|
||||
|
||||
# CI-Node: Long2
|
||||
|
||||
|
||||
class TestAccept(unittest.TestCase):
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
|
@ -20,6 +20,8 @@ import time
|
||||
import yaml
|
||||
from . import OBSLocal
|
||||
|
||||
# CI-Node: Long2
|
||||
|
||||
|
||||
class TestOrigin(OBSLocal.TestCase):
|
||||
script = './origin-manager.py'
|
||||
|
@ -11,6 +11,8 @@ from lxml import etree as ET
|
||||
from mock import MagicMock
|
||||
from . import OBSLocal
|
||||
|
||||
# CI-Node: Long1
|
||||
|
||||
|
||||
class TestSelect(OBSLocal.TestCase):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user