aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/cleaner_tests/basic_function_tests/binary_test.py (renamed from tests/test_data/fake_plugins/binary_test.py)0
-rw-r--r--tests/cleaner_tests/basic_function_tests/binary_test.tar.xz (renamed from tests/test_data/var/log/binary_test.tar.xz)bin208 -> 208 bytes
-rw-r--r--tests/cleaner_tests/basic_function_tests/report_with_mask.py (renamed from tests/cleaner_tests/report_with_mask.py)4
-rw-r--r--tests/cleaner_tests/full_report/default_mapping (renamed from tests/test_data/etc/sos/cleaner/default_mapping)0
-rw-r--r--tests/cleaner_tests/full_report/full_report_run.py (renamed from tests/cleaner_tests/full_report_run.py)2
-rw-r--r--tests/cleaner_tests/skip_versioning/skip_version_ip_parser.py (renamed from tests/cleaner_tests/skip_version_ip_parser.py)5
-rw-r--r--tests/cleaner_tests/skip_versioning/skip_versions.py (renamed from tests/test_data/fake_plugins/skip_versions.py)0
-rw-r--r--tests/cleaner_tests/skip_versioning/sos-test-version-noskip (renamed from tests/test_data/tmp/sos-test-version-noskip)0
-rw-r--r--tests/cleaner_tests/skip_versioning/sos-test-version.txt (renamed from tests/test_data/tmp/sos-test-version.txt)0
-rw-r--r--tests/cleaner_tests/unicode_open/sos-test-unicode.txt (renamed from tests/test_data/tmp/sos-test-unicode.txt)0
-rw-r--r--tests/cleaner_tests/unicode_open/unicode_in_file.py (renamed from tests/cleaner_tests/unicode_in_file.py)2
-rw-r--r--tests/cleaner_tests/unicode_open/unicode_test.py (renamed from tests/test_data/fake_plugins/unicode_test.py)0
-rw-r--r--tests/report_tests/options_tests/options_tests.py (renamed from tests/report_tests/options_tests.py)2
-rw-r--r--tests/report_tests/options_tests/options_tests_sos.conf (renamed from tests/test_data/etc/sos/options_tests_sos.conf)0
-rw-r--r--tests/report_tests/plugin_tests/plugin_environment/default_env_test.py (renamed from tests/test_data/fake_plugins/default_env_test.py)0
-rw-r--r--tests/report_tests/plugin_tests/plugin_environment/plugin_environment.py (renamed from tests/report_tests/plugin_tests/plugin_environment.py)2
-rw-r--r--tests/report_tests/plugin_tests/sos_extras/sos_extras.py (renamed from tests/report_tests/plugin_tests/sos_extras.py)2
-rw-r--r--tests/report_tests/plugin_tests/sos_extras/sos_testing.conf (renamed from tests/test_data/etc/sos/extras.d/sos_testing.conf)0
-rw-r--r--tests/report_tests/plugin_tests/sudo/sudo-ldap.conf (renamed from tests/test_data/etc/sudo-ldap.conf)0
-rw-r--r--tests/report_tests/plugin_tests/sudo/sudo.py (renamed from tests/report_tests/plugin_tests/sudo.py)2
-rw-r--r--tests/report_tests/timeout/timeout_test.py (renamed from tests/test_data/fake_plugins/timeout_test.py)0
-rw-r--r--tests/report_tests/timeout/timeout_tests.py (renamed from tests/report_tests/timeout_tests.py)0
-rw-r--r--tests/sos_tests.py20
-rw-r--r--tests/vendor_tests/redhat/rhbz1950350/clean_config_test.txt (renamed from tests/test_data/var/log/clean_config_test.txt)0
-rw-r--r--tests/vendor_tests/redhat/rhbz1950350/rhbz1950350.py (renamed from tests/vendor_tests/redhat/rhbz1950350.py)7
-rw-r--r--tests/vendor_tests/redhat/rhbz1950350/sos.conf (renamed from tests/test_data/etc/sos/sos.conf)0
-rw-r--r--tests/vendor_tests/redhat/rhbz1950350/sos_clean_config.conf (renamed from tests/test_data/etc/sos/extras.d/sos_clean_config.conf)0
-rw-r--r--tests/vendor_tests/redhat/rhbz2018033/rhbz2018033.py (renamed from tests/vendor_tests/redhat/rhbz2018033.py)0
l---------tests/vendor_tests/redhat/rhbz2018033/timeout_test.py1
29 files changed, 27 insertions, 22 deletions
diff --git a/tests/test_data/fake_plugins/binary_test.py b/tests/cleaner_tests/basic_function_tests/binary_test.py
index 80bc841b..80bc841b 100644
--- a/tests/test_data/fake_plugins/binary_test.py
+++ b/tests/cleaner_tests/basic_function_tests/binary_test.py
diff --git a/tests/test_data/var/log/binary_test.tar.xz b/tests/cleaner_tests/basic_function_tests/binary_test.tar.xz
index 6031c869..6031c869 100644
--- a/tests/test_data/var/log/binary_test.tar.xz
+++ b/tests/cleaner_tests/basic_function_tests/binary_test.tar.xz
Binary files differ
diff --git a/tests/cleaner_tests/report_with_mask.py b/tests/cleaner_tests/basic_function_tests/report_with_mask.py
index 9b1a9edb..352f3867 100644
--- a/tests/cleaner_tests/report_with_mask.py
+++ b/tests/cleaner_tests/basic_function_tests/report_with_mask.py
@@ -78,7 +78,7 @@ class DefaultRemoveBinaryFilesTest(StageTwoReportTest):
:avocado: tags=stagetwo
"""
- files = ['/var/log/binary_test.tar.xz']
+ files = [('binary_test.tar.xz', '/var/log/binary_test.tar.xz')]
install_plugins = ['binary_test']
sos_cmd = '--clean -o binary_test,kernel,host'
@@ -95,7 +95,7 @@ class KeepBinaryFilesTest(StageTwoReportTest):
:avocado: tags=stagetwo
"""
- files = ['/var/log/binary_test.tar.xz']
+ files = [('binary_test.tar.xz', '/var/log/binary_test.tar.xz')]
install_plugins = ['binary_test']
sos_cmd = '--clean --keep-binary-files -o binary_test,kernel,host'
diff --git a/tests/test_data/etc/sos/cleaner/default_mapping b/tests/cleaner_tests/full_report/default_mapping
index e69de29b..e69de29b 100644
--- a/tests/test_data/etc/sos/cleaner/default_mapping
+++ b/tests/cleaner_tests/full_report/default_mapping
diff --git a/tests/cleaner_tests/full_report_run.py b/tests/cleaner_tests/full_report/full_report_run.py
index 0b23acaf..d17287a8 100644
--- a/tests/cleaner_tests/full_report_run.py
+++ b/tests/cleaner_tests/full_report/full_report_run.py
@@ -25,7 +25,7 @@ class FullCleanTest(StageTwoReportTest):
sos_timeout = 600
# replace with an empty placeholder, make sure that this test case is not
# influenced by previous clean runs
- files = ['/etc/sos/cleaner/default_mapping']
+ files = [('default_mapping', '/etc/sos/cleaner/default_mapping')]
packages = {
'rhel': ['python3-systemd'],
'ubuntu': ['python3-systemd']
diff --git a/tests/cleaner_tests/skip_version_ip_parser.py b/tests/cleaner_tests/skip_versioning/skip_version_ip_parser.py
index 882244ea..957585dd 100644
--- a/tests/cleaner_tests/skip_version_ip_parser.py
+++ b/tests/cleaner_tests/skip_versioning/skip_version_ip_parser.py
@@ -18,7 +18,10 @@ class SkipVersionIPParser(StageTwoReportTest):
:avocado: tags=stagetwo
"""
- files = [DO_SKIP, NO_SKIP]
+ files = [
+ ('sos-test-version.txt', DO_SKIP),
+ ('sos-test-version-noskip', NO_SKIP)
+ ]
install_plugins = ['skip_versions']
sos_cmd = '--clean -o skip_versions'
diff --git a/tests/test_data/fake_plugins/skip_versions.py b/tests/cleaner_tests/skip_versioning/skip_versions.py
index e8a1d533..e8a1d533 100644
--- a/tests/test_data/fake_plugins/skip_versions.py
+++ b/tests/cleaner_tests/skip_versioning/skip_versions.py
diff --git a/tests/test_data/tmp/sos-test-version-noskip b/tests/cleaner_tests/skip_versioning/sos-test-version-noskip
index bc5558de..bc5558de 100644
--- a/tests/test_data/tmp/sos-test-version-noskip
+++ b/tests/cleaner_tests/skip_versioning/sos-test-version-noskip
diff --git a/tests/test_data/tmp/sos-test-version.txt b/tests/cleaner_tests/skip_versioning/sos-test-version.txt
index 62a96e57..62a96e57 100644
--- a/tests/test_data/tmp/sos-test-version.txt
+++ b/tests/cleaner_tests/skip_versioning/sos-test-version.txt
diff --git a/tests/test_data/tmp/sos-test-unicode.txt b/tests/cleaner_tests/unicode_open/sos-test-unicode.txt
index 7dc00099..7dc00099 100644
--- a/tests/test_data/tmp/sos-test-unicode.txt
+++ b/tests/cleaner_tests/unicode_open/sos-test-unicode.txt
diff --git a/tests/cleaner_tests/unicode_in_file.py b/tests/cleaner_tests/unicode_open/unicode_in_file.py
index 522cedd7..01a980f5 100644
--- a/tests/cleaner_tests/unicode_in_file.py
+++ b/tests/cleaner_tests/unicode_open/unicode_in_file.py
@@ -18,7 +18,7 @@ class UnicodeOpenTest(StageTwoReportTest):
"""
sos_cmd = '--clean -o unicode_test,networking,host'
- files = ['/tmp/sos-test-unicode.txt']
+ files = [('sos-test-unicode.txt', '/tmp/sos-test-unicode.txt')]
install_plugins = ['unicode_test']
def test_file_was_collected(self):
diff --git a/tests/test_data/fake_plugins/unicode_test.py b/tests/cleaner_tests/unicode_open/unicode_test.py
index 541dfb5c..541dfb5c 100644
--- a/tests/test_data/fake_plugins/unicode_test.py
+++ b/tests/cleaner_tests/unicode_open/unicode_test.py
diff --git a/tests/report_tests/options_tests.py b/tests/report_tests/options_tests/options_tests.py
index 17948795..f8e1ee60 100644
--- a/tests/report_tests/options_tests.py
+++ b/tests/report_tests/options_tests/options_tests.py
@@ -16,7 +16,7 @@ class OptionsFromConfigTest(StageTwoReportTest):
:avocado: tags=stagetwo
"""
- files = [('/etc/sos/options_tests_sos.conf', '/etc/sos/sos.conf')]
+ files = [('options_tests_sos.conf', '/etc/sos/sos.conf')]
sos_cmd = '-v '
def test_case_id_from_config(self):
diff --git a/tests/test_data/etc/sos/options_tests_sos.conf b/tests/report_tests/options_tests/options_tests_sos.conf
index c0f641d9..c0f641d9 100644
--- a/tests/test_data/etc/sos/options_tests_sos.conf
+++ b/tests/report_tests/options_tests/options_tests_sos.conf
diff --git a/tests/test_data/fake_plugins/default_env_test.py b/tests/report_tests/plugin_tests/plugin_environment/default_env_test.py
index d1d1fb78..d1d1fb78 100644
--- a/tests/test_data/fake_plugins/default_env_test.py
+++ b/tests/report_tests/plugin_tests/plugin_environment/default_env_test.py
diff --git a/tests/report_tests/plugin_tests/plugin_environment.py b/tests/report_tests/plugin_tests/plugin_environment/plugin_environment.py
index 3158437a..d7d36069 100644
--- a/tests/report_tests/plugin_tests/plugin_environment.py
+++ b/tests/report_tests/plugin_tests/plugin_environment/plugin_environment.py
@@ -16,7 +16,7 @@ class PluginDefaultEnvironmentTest(StageTwoReportTest):
Ensure that being able to set a default set of environment variables is
working correctly and does not leave a lingering env var on the system
- :avocado: tags=stageone
+ :avocado: tags=stagetwo
"""
install_plugins = ['default_env_test']
diff --git a/tests/report_tests/plugin_tests/sos_extras.py b/tests/report_tests/plugin_tests/sos_extras/sos_extras.py
index fa618ffb..ae5c347a 100644
--- a/tests/report_tests/plugin_tests/sos_extras.py
+++ b/tests/report_tests/plugin_tests/sos_extras/sos_extras.py
@@ -16,7 +16,7 @@ class SosExtrasPluginTest(StageTwoReportTest):
:avocado: tags=stagetwo
"""
- files = ['/etc/sos/extras.d/sos_testing.conf']
+ files = [('sos_testing.conf', '/etc/sos/extras.d/sos_testing.conf')]
# rather than only enabling this plugin, make sure the enablement trigger
# is working
sos_cmd = '-n logs,networking,devicemapper,filesys,systemd'
diff --git a/tests/test_data/etc/sos/extras.d/sos_testing.conf b/tests/report_tests/plugin_tests/sos_extras/sos_testing.conf
index 40651f4d..40651f4d 100644
--- a/tests/test_data/etc/sos/extras.d/sos_testing.conf
+++ b/tests/report_tests/plugin_tests/sos_extras/sos_testing.conf
diff --git a/tests/test_data/etc/sudo-ldap.conf b/tests/report_tests/plugin_tests/sudo/sudo-ldap.conf
index 76300658..76300658 100644
--- a/tests/test_data/etc/sudo-ldap.conf
+++ b/tests/report_tests/plugin_tests/sudo/sudo-ldap.conf
diff --git a/tests/report_tests/plugin_tests/sudo.py b/tests/report_tests/plugin_tests/sudo/sudo.py
index ad766b4f..e04a73a7 100644
--- a/tests/report_tests/plugin_tests/sudo.py
+++ b/tests/report_tests/plugin_tests/sudo/sudo.py
@@ -29,7 +29,7 @@ class SudoLdapScrubbedTest(StageTwoReportTest):
"""
sos_cmd = '-o sudo'
- files = ['/etc/sudo-ldap.conf']
+ files = [('sudo-ldap.conf', '/etc/sudo-ldap.conf')]
def test_bindpw_scrubbed(self):
self.assertFileNotHasContent('/etc/sudo-ldap.conf', 'sostestpassword')
diff --git a/tests/test_data/fake_plugins/timeout_test.py b/tests/report_tests/timeout/timeout_test.py
index cfb148d7..cfb148d7 100644
--- a/tests/test_data/fake_plugins/timeout_test.py
+++ b/tests/report_tests/timeout/timeout_test.py
diff --git a/tests/report_tests/timeout_tests.py b/tests/report_tests/timeout/timeout_tests.py
index ffce9231..ffce9231 100644
--- a/tests/report_tests/timeout_tests.py
+++ b/tests/report_tests/timeout/timeout_tests.py
diff --git a/tests/sos_tests.py b/tests/sos_tests.py
index a178ce4a..3e4154b1 100644
--- a/tests/sos_tests.py
+++ b/tests/sos_tests.py
@@ -14,6 +14,7 @@ from avocado.utils import archive, process, distro, software_manager
from fnmatch import fnmatch
import glob
+import inspect
import json
import os
import pickle
@@ -791,7 +792,7 @@ class StageTwoReportTest(BaseSoSReportTest):
for plug in self.install_plugins:
if not plug.endswith('.py'):
plug += '.py'
- fake_plug = os.path.join(SOS_TEST_DATA_DIR, 'fake_plugins', plug)
+ fake_plug = os.path.join(os.path.dirname(inspect.getfile(self.__class__)), plug)
if os.path.exists(fake_plug):
shutil.copy(fake_plug, SOS_PLUGIN_DIR)
_installed.append(os.path.realpath(os.path.join(SOS_PLUGIN_DIR, plug)))
@@ -846,23 +847,21 @@ class StageTwoReportTest(BaseSoSReportTest):
for pkg in pkgs:
self.sm.remove(pkg)
- def _copy_test_file(self, src, dest=None):
+ def _copy_test_file(self, filetup):
"""Helper to copy files from tests/test_data to relevant locations on
the test system. If ``dest`` is provided, use that as the destination
filename instead of using the ``src`` name
"""
-
- if dest is None:
- dest = src
+ src, dest = filetup
dir_added = False
if os.path.exists(dest):
os.rename(dest, dest + '.sostesting')
- _dir = os.path.split(src)[0]
+ _dir = os.path.dirname(dest)
if not os.path.exists(_dir):
os.makedirs(_dir)
self._created_files.append(_dir)
dir_added = True
- _test_file = os.path.join(SOS_TEST_DIR, 'test_data', src.lstrip('/'))
+ _test_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)), src.lstrip('/'))
shutil.copy(_test_file, dest)
if not dir_added:
self._created_files.append(dest)
@@ -876,10 +875,9 @@ class StageTwoReportTest(BaseSoSReportTest):
test(s) have run.
"""
for mfile in self.files:
- if isinstance(mfile, tuple):
- self._copy_test_file(mfile[0], mfile[1])
- else:
- self._copy_test_file(mfile)
+ if not isinstance(mfile, tuple):
+ raise Exception(f"Mocked files must be provided via tuples, not {mfile.__class__}")
+ self._copy_test_file(mfile)
if self._created_files:
self._write_file_to_tmpdir('mocked_files', json.dumps(self._created_files))
diff --git a/tests/test_data/var/log/clean_config_test.txt b/tests/vendor_tests/redhat/rhbz1950350/clean_config_test.txt
index f1bdb127..f1bdb127 100644
--- a/tests/test_data/var/log/clean_config_test.txt
+++ b/tests/vendor_tests/redhat/rhbz1950350/clean_config_test.txt
diff --git a/tests/vendor_tests/redhat/rhbz1950350.py b/tests/vendor_tests/redhat/rhbz1950350/rhbz1950350.py
index 9eab2914..991cb76d 100644
--- a/tests/vendor_tests/redhat/rhbz1950350.py
+++ b/tests/vendor_tests/redhat/rhbz1950350/rhbz1950350.py
@@ -17,8 +17,11 @@ class rhbz1950350(StageTwoReportTest):
:avocado: tags=stagetwo
"""
- files = ['/etc/sos/sos.conf', '/etc/sos/extras.d/sos_clean_config.conf',
- '/var/log/clean_config_test.txt']
+ files = [
+ ('sos.conf', '/etc/sos/sos.conf'),
+ ('sos_clean_config.conf', '/etc/sos/extras.d/sos_clean_config.conf'),
+ ('clean_config_test.txt', '/var/log/clean_config_test.txt')
+ ]
sos_cmd = '-v -o sos_extras --clean'
diff --git a/tests/test_data/etc/sos/sos.conf b/tests/vendor_tests/redhat/rhbz1950350/sos.conf
index 45bdf3fe..45bdf3fe 100644
--- a/tests/test_data/etc/sos/sos.conf
+++ b/tests/vendor_tests/redhat/rhbz1950350/sos.conf
diff --git a/tests/test_data/etc/sos/extras.d/sos_clean_config.conf b/tests/vendor_tests/redhat/rhbz1950350/sos_clean_config.conf
index 7cf2748d..7cf2748d 100644
--- a/tests/test_data/etc/sos/extras.d/sos_clean_config.conf
+++ b/tests/vendor_tests/redhat/rhbz1950350/sos_clean_config.conf
diff --git a/tests/vendor_tests/redhat/rhbz2018033.py b/tests/vendor_tests/redhat/rhbz2018033/rhbz2018033.py
index 25b9090c..25b9090c 100644
--- a/tests/vendor_tests/redhat/rhbz2018033.py
+++ b/tests/vendor_tests/redhat/rhbz2018033/rhbz2018033.py
diff --git a/tests/vendor_tests/redhat/rhbz2018033/timeout_test.py b/tests/vendor_tests/redhat/rhbz2018033/timeout_test.py
new file mode 120000
index 00000000..b2ece0e1
--- /dev/null
+++ b/tests/vendor_tests/redhat/rhbz2018033/timeout_test.py
@@ -0,0 +1 @@
+../../../report_tests/timeout/timeout_test.py \ No newline at end of file