From 3b1bca1f718d7149fa919f392b97375fbbf4cc4a Mon Sep 17 00:00:00 2001
From: Felix Fontein <felix@fontein.de>
Date: Thu, 2 Apr 2020 11:56:38 +0200
Subject: [PATCH] Network removal cleanup (#92)

* Reduce requirements.

* Remove unit test group 2.

* Reduce to four sanity groups.

* Fix paths.
---
 galaxy.yml                         | 10 +----
 shippable.yml                      |  9 ----
 tests/requirements.yml             | 14 +++---
 tests/utils/shippable/sanity.sh    |  7 ++-
 tests/utils/shippable/shippable.sh | 15 ++-----
 tests/utils/shippable/units.sh     | 69 ------------------------------
 6 files changed, 14 insertions(+), 110 deletions(-)

diff --git a/galaxy.yml b/galaxy.yml
index 81b8d476f8..9831f1cb41 100644
--- a/galaxy.yml
+++ b/galaxy.yml
@@ -10,18 +10,12 @@ license_file: COPYING
 tags: null
 # NOTE: No more dependencies can be added to this list
 #dependencies:
-#  community.kubernetes: '>=0.1.0'
-#  ovirt.ovirt_collection: '>=0.1.0'
 #  ansible.netcommon: '>=0.1.0'
-#  cisco.mso: '>=0.1.0'
 #  ansible.posix: '>=0.1.0'
-#  cisco.aci: '>=0.1.0'
 #  cisco.intersight: '>=0.1.0'
-#  check_point.mgmt: '>=0.1.0'
-#  fortinet.fortios: '>=0.1.0'
-#  openstack.cloud: '>=0.1.0'
+#  community.kubernetes: '>=0.1.0'
 #  google.cloud: '>=0.1.0'
-#  f5networks.f5_modules: '>=0.1.0'
+#  ovirt.ovirt_collection: '>=0.1.0'
 repository: https://github.com/ansible-collections/community.general
 documentation: https://github.com/ansible-collection-migration/community.general/tree/master/docs
 homepage: https://github.com/ansible-collections/community.general
diff --git a/shippable.yml b/shippable.yml
index 2890892cab..a78d7799ba 100644
--- a/shippable.yml
+++ b/shippable.yml
@@ -12,7 +12,6 @@ matrix:
     - env: T=sanity/2
     - env: T=sanity/3
     - env: T=sanity/4
-    - env: T=sanity/5
 
     - env: T=units/2.6/1
     - env: T=units/2.7/1
@@ -22,14 +21,6 @@ matrix:
     - env: T=units/3.8/1
     - env: T=units/3.9/1
 
-    - env: T=units/2.6/2
-    - env: T=units/2.7/2
-    - env: T=units/3.5/2
-    - env: T=units/3.6/2
-    - env: T=units/3.7/2
-    - env: T=units/3.8/2
-    - env: T=units/3.9/2
-
     - env: T=aix/7.2/1
     - env: T=osx/10.11/1
     - env: T=rhel/7.6/1
diff --git a/tests/requirements.yml b/tests/requirements.yml
index d554985fd0..c7181c78a1 100644
--- a/tests/requirements.yml
+++ b/tests/requirements.yml
@@ -1,14 +1,12 @@
 integration_tests_dependencies:
+- ansible.netcommon
 - ansible.posix
 - community.crypto
-- ansible.netcommon
-unit_tests_dependencies:
-- netbox.netbox
 - community.kubernetes
+unit_tests_dependencies:
 - ansible.netcommon
-- cisco.meraki
-- fortinet.fortios
-- junipernetworks.junos
-- cisco.aci
+- ansible.posix
+- cisco.intersight
+- community.kubernetes
 - google.cloud
-- f5networks.f5_modules
+- ovirt.ovirt_collection
diff --git a/tests/utils/shippable/sanity.sh b/tests/utils/shippable/sanity.sh
index ecbd63220e..a52030c064 100755
--- a/tests/utils/shippable/sanity.sh
+++ b/tests/utils/shippable/sanity.sh
@@ -15,10 +15,9 @@ fi
 
 case "${group}" in
     1) options=(--skip-test pylint --skip-test ansible-doc --skip-test validate-modules) ;;
-    2) options=(                   --test      ansible-doc                             ) ;;
-    3) options=(                                                --test validate-modules) ;;
-    4) options=(--test pylint --exclude tests/unit/ --exclude plugins/module_utils/) ;;
-    5) options=(--test pylint           tests/unit/           plugins/module_utils/) ;;
+    2) options=(                   --test      ansible-doc      --test validate-modules) ;;
+    3) options=(--test pylint           plugins/modules/) ;;
+    4) options=(--test pylint --exclude plugins/modules/) ;;
 esac
 
 # allow collection migration sanity tests for groups 3 and 4 to pass without updating this script during migration
diff --git a/tests/utils/shippable/shippable.sh b/tests/utils/shippable/shippable.sh
index b20f333da2..11355b290b 100755
--- a/tests/utils/shippable/shippable.sh
+++ b/tests/utils/shippable/shippable.sh
@@ -55,22 +55,13 @@ cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
 cd "${TEST_DIR}"
 
 # STAR: HACK install dependencies
-retry ansible-galaxy -vvv collection install ansible.posix
-retry ansible-galaxy -vvv collection install community.crypto
 retry ansible-galaxy -vvv collection install ansible.netcommon
-retry ansible-galaxy -vvv collection install ovirt.ovirt_collection
-retry ansible-galaxy -vvv collection install cisco.mso
+retry ansible-galaxy -vvv collection install ansible.posix
 retry ansible-galaxy -vvv collection install cisco.intersight
-retry ansible-galaxy -vvv collection install check_point.mgmt
+retry ansible-galaxy -vvv collection install community.crypto
 retry ansible-galaxy -vvv collection install community.kubernetes
-retry ansible-galaxy -vvv collection install f5networks.f5_modules
-retry ansible-galaxy -vvv collection install fortinet.fortios
-retry ansible-galaxy -vvv collection install cisco.aci
 retry ansible-galaxy -vvv collection install google.cloud
-
-# unit tests
-retry ansible-galaxy -vvv collection install cisco.meraki
-retry ansible-galaxy -vvv collection install junipernetworks.junos
+retry ansible-galaxy -vvv collection install ovirt.ovirt_collection
 
 # END: HACK
 
diff --git a/tests/utils/shippable/units.sh b/tests/utils/shippable/units.sh
index 0dc8cb818b..38e79935e7 100755
--- a/tests/utils/shippable/units.sh
+++ b/tests/utils/shippable/units.sh
@@ -15,80 +15,11 @@ else
 fi
 
 group1=()
-group2=()
-group3=()
-
-# create two groups by putting network tests into another group
-# 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
-)
-
-for network in "${networks2[@]}"; do
-    test_path="tests/unit/modules/network/${network}/"
-
-    if [ -d "${test_path}" ]; then
-        group1+=(--exclude "${test_path}")
-        group2+=("${test_path}")
-    fi
-done
 
 case "${group}" in
     1) options=("${group1[@]:+${group1[@]}}") ;;
-    2) options=("${group2[@]:+${group2[@]}}") ;;
 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