summaryrefslogtreecommitdiffstats
path: root/collections-debian-merged/ansible_collections/community/rabbitmq/tests/utils/shippable/units.sh
blob: e2ff963f19f1ad42d80b7d5157517c1e4038058b (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash

set -o pipefail -eux

declare -a args
IFS='/:' read -ra args <<< "$1"

version="${args[1]}"
group="${args[2]}"

if [[ "${COVERAGE:-}" == "--coverage" ]]; then
    timeout=90
else
    timeout=30
fi

group1=()
group2=()
group3=()

# create three groups by putting network tests into separate groups
# add or remove network platforms as needed to balance the groups

networks2=(
    aireos
    apconos
    aruba
    asa
    avi
    check_point
    cloudengine
    cloudvision
    cnos
    cumulus
    dellos10
    dellos6
    dellos9
    edgeos
    edgeswitch
    enos
    eos
    eric_eccli
    exos
    f5
    fortimanager
    frr
    ftd
    icx
    ingate
    ios
    iosxr
    ironware
    itential
    junos
    netact
    netscaler
    netvisor
    nos
    nso
    nuage
    nxos
    onyx
    opx
    ovs
    radware
    routeros
    slxos
    voss
    vyos
)

networks3=(
    fortios
)

for network in "${networks2[@]}"; do
    test_path="test/units/modules/network/${network}/"

    if [ -d "${test_path}" ]; then
        group1+=(--exclude "${test_path}")
        group2+=("${test_path}")
    fi
done

for network in "${networks3[@]}"; do
    test_path="test/units/modules/network/${network}/"

    if [ -d "${test_path}" ]; then
        group1+=(--exclude "${test_path}")
        group3+=("${test_path}")
    fi
done

case "${group}" in
    1) options=("${group1[@]:+${group1[@]}}") ;;
    2) options=("${group2[@]:+${group2[@]}}") ;;
    3) options=("${group3[@]:+${group3[@]}}") ;;
esac

if [ ${#options[@]} -eq 0 ] && [ "${group}" -gt 1 ]; then
    # allow collection migration unit tests for groups other than 1 to "pass" without updating shippable.yml or this script during migration
    echo "No unit tests found for group ${group}."
    exit
fi

ansible-test env --timeout "${timeout}" --color -v

# shellcheck disable=SC2086
ansible-test units --color -v --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
    "${options[@]:+${options[@]}}" \