From 71819c0a602b57f8f1873a8fd6d0d831dfff3d32 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 31 Oct 2016 12:53:11 -0700 Subject: [PATCH] Test reorganization and cleanup. (#18270) - Correct directory name in test/README.md - Move code-smell tests to test/sanity/code-smell - Update code-smell.sh to use new script paths - Add test/integration/target-prefixes.win for ansible-test - Move module unit tests to match module directory layout --- test/README.md | 4 ++-- test/integration/target-prefixes.win | 1 + test/{ => sanity}/code-smell/boilerplate.sh | 0 test/{ => sanity}/code-smell/inappropriately-private.sh | 0 test/{ => sanity}/code-smell/no-basestring.sh | 0 test/{ => sanity}/code-smell/replace-urlopen.sh | 0 .../code-smell/required-and-default-attributes.sh | 0 test/{ => sanity}/code-smell/use-compat-six.sh | 0 test/units/modules/core/cloud/__init__.py | 0 test/units/modules/core/cloud/docker/__init__.py | 0 test/units/modules/core/{ => cloud/docker}/test_docker.py | 0 test/units/modules/core/packaging/__init__.py | 0 test/units/modules/core/packaging/os/__init__.py | 0 test/units/modules/core/{ => packaging/os}/test_apt.py | 0 test/utils/shippable/code-smell.sh | 8 ++++---- 15 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 test/integration/target-prefixes.win rename test/{ => sanity}/code-smell/boilerplate.sh (100%) rename test/{ => sanity}/code-smell/inappropriately-private.sh (100%) rename test/{ => sanity}/code-smell/no-basestring.sh (100%) rename test/{ => sanity}/code-smell/replace-urlopen.sh (100%) rename test/{ => sanity}/code-smell/required-and-default-attributes.sh (100%) rename test/{ => sanity}/code-smell/use-compat-six.sh (100%) create mode 100644 test/units/modules/core/cloud/__init__.py create mode 100644 test/units/modules/core/cloud/docker/__init__.py rename test/units/modules/core/{ => cloud/docker}/test_docker.py (100%) create mode 100644 test/units/modules/core/packaging/__init__.py create mode 100644 test/units/modules/core/packaging/os/__init__.py rename test/units/modules/core/{ => packaging/os}/test_apt.py (100%) diff --git a/test/README.md b/test/README.md index fb541818aeb..3ae6c613827 100644 --- a/test/README.md +++ b/test/README.md @@ -4,8 +4,8 @@ Ansible Test System Folders ======= -unit ----- +units +----- Unit tests that test small pieces of code not suited for the integration test layer, usually very API based, and should leverage mock interfaces rather than producing side effects. diff --git a/test/integration/target-prefixes.win b/test/integration/target-prefixes.win new file mode 100644 index 00000000000..58382f8c03a --- /dev/null +++ b/test/integration/target-prefixes.win @@ -0,0 +1 @@ +win diff --git a/test/code-smell/boilerplate.sh b/test/sanity/code-smell/boilerplate.sh similarity index 100% rename from test/code-smell/boilerplate.sh rename to test/sanity/code-smell/boilerplate.sh diff --git a/test/code-smell/inappropriately-private.sh b/test/sanity/code-smell/inappropriately-private.sh similarity index 100% rename from test/code-smell/inappropriately-private.sh rename to test/sanity/code-smell/inappropriately-private.sh diff --git a/test/code-smell/no-basestring.sh b/test/sanity/code-smell/no-basestring.sh similarity index 100% rename from test/code-smell/no-basestring.sh rename to test/sanity/code-smell/no-basestring.sh diff --git a/test/code-smell/replace-urlopen.sh b/test/sanity/code-smell/replace-urlopen.sh similarity index 100% rename from test/code-smell/replace-urlopen.sh rename to test/sanity/code-smell/replace-urlopen.sh diff --git a/test/code-smell/required-and-default-attributes.sh b/test/sanity/code-smell/required-and-default-attributes.sh similarity index 100% rename from test/code-smell/required-and-default-attributes.sh rename to test/sanity/code-smell/required-and-default-attributes.sh diff --git a/test/code-smell/use-compat-six.sh b/test/sanity/code-smell/use-compat-six.sh similarity index 100% rename from test/code-smell/use-compat-six.sh rename to test/sanity/code-smell/use-compat-six.sh diff --git a/test/units/modules/core/cloud/__init__.py b/test/units/modules/core/cloud/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/units/modules/core/cloud/docker/__init__.py b/test/units/modules/core/cloud/docker/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/units/modules/core/test_docker.py b/test/units/modules/core/cloud/docker/test_docker.py similarity index 100% rename from test/units/modules/core/test_docker.py rename to test/units/modules/core/cloud/docker/test_docker.py diff --git a/test/units/modules/core/packaging/__init__.py b/test/units/modules/core/packaging/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/units/modules/core/packaging/os/__init__.py b/test/units/modules/core/packaging/os/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/units/modules/core/test_apt.py b/test/units/modules/core/packaging/os/test_apt.py similarity index 100% rename from test/units/modules/core/test_apt.py rename to test/units/modules/core/packaging/os/test_apt.py diff --git a/test/utils/shippable/code-smell.sh b/test/utils/shippable/code-smell.sh index 97ca8308f50..c544b1015cb 100755 --- a/test/utils/shippable/code-smell.sh +++ b/test/utils/shippable/code-smell.sh @@ -16,10 +16,10 @@ if [ "${install_deps}" != "" ]; then fi yamllint . -test/code-smell/replace-urlopen.sh . -test/code-smell/use-compat-six.sh lib -test/code-smell/boilerplate.sh -test/code-smell/required-and-default-attributes.sh +test/sanity/code-smell/replace-urlopen.sh . +test/sanity/code-smell/use-compat-six.sh lib +test/sanity/code-smell/boilerplate.sh +test/sanity/code-smell/required-and-default-attributes.sh shellcheck \ test/integration/targets/*/*.sh \