Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable tests on FreeBSD #58088

Merged
merged 2 commits into from Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions tests/integration/pillar/test_git_pillar.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Integration tests for git_pillar

Expand Down Expand Up @@ -65,7 +64,6 @@
"""

# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals

import random
import string
Expand Down Expand Up @@ -111,7 +109,7 @@


def _rand_key_name(length):
return "id_rsa_{0}".format(
return "id_rsa_{}".format(
"".join(random.choice(string.ascii_letters) for _ in range(length))
)

Expand All @@ -120,7 +118,7 @@ def _windows_or_mac():
return salt.utils.platform.is_windows() or salt.utils.platform.is_darwin()


class GitPythonMixin(object):
class GitPythonMixin:
"""
GitPython doesn't support anything fancy in terms of authentication
options, so all of the tests for GitPython can be re-used via this mixin.
Expand Down Expand Up @@ -631,8 +629,9 @@ def test_fallback(self):

@destructiveTest
@skipIf(_windows_or_mac(), "minion is windows or mac")
@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
@skip_if_not_root
@skipIf(not HAS_GITPYTHON, "GitPython >= {0} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_GITPYTHON, "GitPython >= {} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_SSHD, "sshd not present")
class TestGitPythonSSH(GitPillarSSHTestBase, GitPythonMixin):
"""
Expand All @@ -647,7 +646,7 @@ class TestGitPythonSSH(GitPillarSSHTestBase, GitPythonMixin):

@skipIf(_windows_or_mac(), "minion is windows or mac")
@skip_if_not_root
@skipIf(not HAS_GITPYTHON, "GitPython >= {0} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_GITPYTHON, "GitPython >= {} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_NGINX, "nginx not present")
@skipIf(not HAS_VIRTUALENV, "virtualenv not present")
class TestGitPythonHTTP(GitPillarHTTPTestBase, GitPythonMixin):
Expand All @@ -658,7 +657,7 @@ class TestGitPythonHTTP(GitPillarHTTPTestBase, GitPythonMixin):

@skipIf(_windows_or_mac(), "minion is windows or mac")
@skip_if_not_root
@skipIf(not HAS_GITPYTHON, "GitPython >= {0} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_GITPYTHON, "GitPython >= {} required".format(GITPYTHON_MINVER))
@skipIf(not HAS_NGINX, "nginx not present")
@skipIf(not HAS_VIRTUALENV, "virtualenv not present")
class TestGitPythonAuthenticatedHTTP(TestGitPythonHTTP, GitPythonMixin):
Expand All @@ -674,7 +673,7 @@ def setUpClass(cls):
"""
Create start the webserver
"""
super(TestGitPythonAuthenticatedHTTP, cls).setUpClass()
super().setUpClass()
# Override the URL set up in the parent class to encode the
# username/password into it.
cls.url = "http://{username}:{password}@127.0.0.1:{port}/repo.git".format(
Expand All @@ -694,7 +693,7 @@ def setUpClass(cls):
@skip_if_not_root
@skipIf(
not HAS_PYGIT2,
"pygit2 >= {0} and libgit2 >= {1} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
"pygit2 >= {} and libgit2 >= {} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
)
@skipIf(not HAS_SSHD, "sshd not present")
class TestPygit2SSH(GitPillarSSHTestBase):
Expand Down Expand Up @@ -2168,7 +2167,7 @@ def test_fallback(self):
@skip_if_not_root
@skipIf(
not HAS_PYGIT2,
"pygit2 >= {0} and libgit2 >= {1} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
"pygit2 >= {} and libgit2 >= {} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
)
@skipIf(not HAS_NGINX, "nginx not present")
@skipIf(not HAS_VIRTUALENV, "virtualenv not present")
Expand Down Expand Up @@ -2676,7 +2675,7 @@ def test_fallback(self):
@skip_if_not_root
@skipIf(
not HAS_PYGIT2,
"pygit2 >= {0} and libgit2 >= {1} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
"pygit2 >= {} and libgit2 >= {} required".format(PYGIT2_MINVER, LIBGIT2_MINVER),
)
@skipIf(not HAS_NGINX, "nginx not present")
@skipIf(not HAS_VIRTUALENV, "virtualenv not present")
Expand Down
10 changes: 4 additions & 6 deletions tests/integration/shell/test_enabled.py
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import

import os
import textwrap

Expand All @@ -28,6 +24,7 @@ class EnabledTest(ModuleCase):
)

@skipIf(salt.utils.platform.is_windows(), "Skip on Windows OS")
@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
def test_shell_default_enabled(self):
"""
ensure that python_shell defaults to True for cmd.run
Expand All @@ -49,6 +46,7 @@ def test_shell_disabled(self):
self.assertEqual(ret, disabled_ret)

@skipIf(salt.utils.platform.is_windows(), "Skip on Windows OS")
@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
def test_template_shell(self):
"""
Test cmd.shell works correctly when using a template.
Expand All @@ -62,7 +60,7 @@ def test_template_shell(self):
state_file = os.path.join(RUNTIME_VARS.BASE_FILES, state_filename)

enabled_ret = "3 saltines" # the result of running self.cmd in a shell
ret_key = "test_|-shell_enabled_|-{0}_|-configurable_test_state".format(
ret_key = "test_|-shell_enabled_|-{}_|-configurable_test_state".format(
enabled_ret
)

Expand Down Expand Up @@ -103,7 +101,7 @@ def test_template_default_disabled(self):
"first second third | wc -l ; export SALTY_VARIABLE=saltines "
"&& echo $SALTY_VARIABLE ; echo duh &> /dev/null"
)
ret_key = "test_|-shell_enabled_|-{0}_|-configurable_test_state".format(
ret_key = "test_|-shell_enabled_|-{}_|-configurable_test_state".format(
disabled_ret
)

Expand Down
35 changes: 27 additions & 8 deletions tests/unit/beacons/test_inotify.py
@@ -1,7 +1,4 @@
# coding: utf-8

# Python libs
from __future__ import absolute_import

import logging
import os
Expand Down Expand Up @@ -68,14 +65,18 @@ def test_files_none_config(self):
self.assertEqual(ret, _expected)

def test_files_list_config(self):
config = [{"files": [{u"/importantfile": {u"mask": [u"modify"]}}]}]
config = [{"files": [{"/importantfile": {"mask": ["modify"]}}]}]
ret = inotify.validate(config)
_expected = (
False,
"Configuration for inotify beacon invalid, files must be a dict.",
)
self.assertEqual(ret, _expected)

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_file_open(self):
path = os.path.realpath(__file__)
config = [{"files": {path: {"mask": ["open"]}}}]
Expand All @@ -92,6 +93,10 @@ def test_file_open(self):
self.assertEqual(ret[0]["path"], path)
self.assertEqual(ret[0]["change"], "IN_OPEN")

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_dir_no_auto_add(self):
config = [{"files": {self.tmpdir: {"mask": ["create"]}}}]
ret = inotify.validate(config)
Expand All @@ -111,7 +116,10 @@ def test_dir_no_auto_add(self):
ret = inotify.beacon(config)
self.assertEqual(ret, [])

@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_dir_auto_add(self):
config = [
{"files": {self.tmpdir: {"mask": ["create", "open"], "auto_add": True}}}
Expand All @@ -137,7 +145,10 @@ def test_dir_auto_add(self):
self.assertEqual(ret[0]["path"], fp)
self.assertEqual(ret[0]["change"], "IN_OPEN")

@skipIf(salt.utils.platform.is_freebsd(), "Skip on FreeBSD")
@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_dir_recurse(self):
dp1 = os.path.join(self.tmpdir, "subdir1")
os.mkdir(dp1)
Expand All @@ -163,6 +174,10 @@ def test_dir_recurse(self):
self.assertEqual(ret[2]["path"], fp)
self.assertEqual(ret[2]["change"], "IN_OPEN")

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_dir_recurse_auto_add(self):
dp1 = os.path.join(self.tmpdir, "subdir1")
os.mkdir(dp1)
Expand Down Expand Up @@ -201,13 +216,17 @@ def test_dir_recurse_auto_add(self):
self.assertEqual(ret[0]["path"], fp)
self.assertEqual(ret[0]["change"], "IN_DELETE")

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_multi_files_exclude(self):
dp1 = os.path.join(self.tmpdir, "subdir1")
dp2 = os.path.join(self.tmpdir, "subdir2")
os.mkdir(dp1)
os.mkdir(dp2)
_exclude1 = "{0}/subdir1/*tmpfile*$".format(self.tmpdir)
_exclude2 = "{0}/subdir2/*filetmp*$".format(self.tmpdir)
_exclude1 = "{}/subdir1/*tmpfile*$".format(self.tmpdir)
_exclude2 = "{}/subdir2/*filetmp*$".format(self.tmpdir)
config = [
{
"files": {
Expand Down
15 changes: 12 additions & 3 deletions tests/unit/beacons/test_watchdog.py
@@ -1,6 +1,3 @@
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals

import os
import shutil
import tempfile
Expand Down Expand Up @@ -66,6 +63,10 @@ def test_empty_config(self):
ret = watchdog.beacon(config)
self.assertEqual(ret, [])

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_file_create(self):
path = os.path.join(self.tmpdir, "tmpfile")

Expand Down Expand Up @@ -125,6 +126,10 @@ def test_file_deleted(self):
self.assertEqual(ret[0]["path"], path)
self.assertEqual(ret[0]["change"], "deleted")

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_file_moved(self):
path = os.path.join(self.tmpdir, "tmpfile")
create(path)
Expand All @@ -140,6 +145,10 @@ def test_file_moved(self):
self.assertEqual(ret[0]["path"], path)
self.assertEqual(ret[0]["change"], "moved")

@skipIf(
salt.utils.platform.is_freebsd(),
"Skip on FreeBSD - does not yet have full inotify/watchdog support",
)
def test_file_create_in_directory(self):
config = [{"directories": {self.tmpdir: {"mask": ["create"]}}}]
self.assertValid(config)
Expand Down