From 7b666607f6a97239b517238e4d19d985a9cde5df Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Dec 27 2023 22:46:33 +0000 Subject: Parallelize test_highstate (5 roles per job) --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79f50c0..865019a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,13 +51,12 @@ test_haproxy: # - salt/profile/proxy/* # - salt/role/proxy* -test_highstate: +.test_highstate: image: registry.opensuse.org/opensuse/infrastructure/containers/heroes-salt-testing-systemd:latest stage: test before_script: - bin/prepare_test_env.sh -g -o Leap,15,5 -s -n - bin/get_formulas.py -c -d /srv/formula -s --clone-from 'https://gitlab.infra.opensuse.org/saltstack-formulas' --clone-branch production - script: bin/test_highstate.sh tags: - docker artifacts: @@ -67,6 +66,67 @@ test_highstate: rules: - if: $CI_COMMIT_BRANCH +test_highstate_1: + extends: + - .test_highstate + script: bin/test_highstate.sh '1,5' + +test_highstate_2: + extends: + - .test_highstate + script: bin/test_highstate.sh '6,10' + +test_highstate_3: + extends: + - .test_highstate + script: bin/test_highstate.sh '11,15' + +test_highstate_4: + extends: + - .test_highstate + script: bin/test_highstate.sh '16,20' + +test_highstate_5: + extends: + - .test_highstate + script: bin/test_highstate.sh '21,25' + +test_highstate_6: + extends: + - .test_highstate + script: bin/test_highstate.sh '26,30' + +test_highstate_7: + extends: + - .test_highstate + script: bin/test_highstate.sh '31,35' + +test_highstate_8: + extends: + - .test_highstate + script: bin/test_highstate.sh '36,40' + +test_highstate_9: + extends: + - .test_highstate + script: bin/test_highstate.sh '41,45' + +test_highstate_10: + extends: + - .test_highstate + script: bin/test_highstate.sh '46,50' + +test_highstate_11: + extends: + - .test_highstate + script: bin/test_highstate.sh '51,55' + +test_highstate_12: + extends: + - .test_highstate + script: bin/test_highstate.sh '56,$' + + test_nginx: image: registry.opensuse.org/opensuse/infrastructure/containers/heroes-salt-testing-nginx:latest stage: test diff --git a/bin/test_highstate.sh b/bin/test_highstate.sh index edb519c..4ee0a4a 100755 --- a/bin/test_highstate.sh +++ b/bin/test_highstate.sh @@ -2,6 +2,11 @@ # Validate that a highstate works for all roles +# Parameters: +# $1 - role numbers (actually line numbers for get_roles.py output) to test. Expects a format for sed -n "$1 p" - for example '1,10' or '50,$' +# if $1 is empty, that means sed -n " p" which will test all roles. + + [[ $(whoami) == 'root' ]] || { echo 'Please run this script as root'; exit 1; } # sysctl: cannot stat /proc/sys/net/core/netdev_max_backlog (and some other /proc files): No such file or directory @@ -160,7 +165,7 @@ succeeded_roles="" failed_roles="" nr=0 -for role in $(bin/get_roles.py); do +for role in $(bin/get_roles.py | sed -n "$1 p"); do nr=$((( $nr + 1))) rolestatus=0 sls_role="salt/role/${role/./\/}.sls"