The tearDown appears to only be removing the grain if it matches a
specific value. This may be leading to the grain value not being blank
at the time the next test is run.
Instead of only deleting the grain if it matches a specific value,
instead delete all items from that grain to ensure that it is empty for
the next test.
This uses a function in the runtests_helpers custom module to perform
all the logic, and only returns what failed the test. This saves us from
having to return the entire contents of sys.doc (as well as log all of
the function calls), and also removes the need to run sys.doc in batches
to get around the "max message size" issue.
* Typo in comment
* First convert to string if not already a string. Then to bytes under Py3.
The reason being that jids from the CLI, at least the one fed in
integration.runners.jobs.ManageTest.test_loopup_jid is loaded as an
integer, and, while the Py2 code converts JIDs to strings, under Py3, we
assume JID's are already strings.
* Mark tests which require root permissions to run
* Allow declaring that the function IS a class method.
```
Python 3.5.3 (default, Jan 21 2017, 00:29:12)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
... def bar(self):
... print('bar')
...
>>> import inspect
>>> inspect.ismethod(Foo.bar)
False
>>> inspect.ismethod(Foo().bar)
True
```
On Python 2, `inspect.ismethod` returns `True` for bound and unbound
methods while on Python 3 it only returns `True` for bound methods.
The explicit `is_class_method` is to avoid instantiating the class just
to get the function signature.
* Always decode responses to the Python version native string implementation
* Just compare the objects as matching list.
Asserting same item count doesn't make that much sense.
* Py3 compatibility
* Fix saltnado tests under Py3
* Python 3 compatibility
* Show me the full traceback
* Revert "Convert fileserver data from bytes to strings"
This reverts commit e53972f8c6.
* Revert "Under Py3, we get `bytes` when using the roots backend directly"
This reverts commit 9f73b240c1.
* Convert from bytes to str if not a binary file
* Py3 compatibility fixes.
Convert file contents from bytes to string if not a binary file
This prevents git_pillar certificate errors. Additionally, sometimes
/dev/rtc becomes unresponsive which leads the ``hwclock --compare``
command to spin indefinitely, ultimately causing the entire test run to
fail. This changeset uses a SIGALRM handler to abort the hwclock command
if no output is seen within 3 seconds and try a second time. If it times
out the second time as well, then an error will be logged but it will
not be fatal to the test (or hang it indefinitely).
In #39060, some tests were added to check for the hardware clock
getting reset when possible. The test attempted to gate the test
when access to the hardware clock was impossible, but the check
wasn't quite right and caused problems with the resulting tests.
This change makes the `has_settable_hwclock()` function public
in order to make the test gate work correctly. This function
could also be useful at the CLI level.
When running `self.run_function('status._has_settable_hwclock()')`
from the test suite, the return is a string noting that the
function is unavailable. This change allows for the `if not` check
to evaluate the return of the function.
This test fails often due to being trimmed, thanks to
salt.utils.dicttrim trimming values > max_event_size.
This commit changes this test so that it runs sys.doc twice, ensuring
that the return from sys.doc (for now) is not trimmed.
Update hardware clock so that date/time changes persist
through reboot.
Add hwclock check to system integration test. Bump tolerance
of _same_times() helper to account for longer run-time of set
operations. Updating hardware rtc's can take more than 2 seconds.
Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
Reviewed-by: Sergey Kizunov <sergey.kizunov@ni.com>
Reviewed-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
Reviewed-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
- Added the "CLI Example:" syntax to function that were missing it
- Added docs to functions missing any docs and CLI examples
- Added to functions to allow_failure in sysmod test as needed
- Also adjusted the ordering of the allow_failure structure to make it
easier to see which modules/funcitons were included (alphabetize)
This test connects to random.org, which may throws the following error
on one network I manage:
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
Other errors are possible, such as `socket.error`. Since it is
difficult to anticipate the failure mode, skip these tests if https
communication provokes any exception.
Also, this is not a unit test--it's more of a system test. My
recommendation that we recategorize this as an integration test where
global IPv4 routing can more reasonably expected.
* Move salt.utils.mkstemp() into salt.utils.files
Also use a default prefix
* update refs to salt.utils.mkstemp
* Update test to use new path to mkstemp helper func
yumpkg.list_upgrades returns an empty dictionary when no upgrades are available.
We need to check for this situation and skip the test if no upgrades are present.
Fixes the test failure on Fedora 24 on Jenkins currently, but also protects against
any potential failures for other RHEL-based distros that aren't currently failing
because "ret" is populated with a dictionary of upgrades.
This test relies on running archive.cmd_zip in order to have something
to test running archive.cmd_unzip against. Some distros will have the
unzip binary available, but not the zip binary. We need to protect this
test against both so we don't have a false failure on trying to run
archive.cmd_zip.
This test relies on running archive.cmd_zip in order to have something
to test running archive.cmd_unzip against. Some distros will have the
unzip binary available, but not the zip binary. We need to protect this
test against both so we don't have a false failure on trying to run
archive.cmd_zip.
Since all pieces of the GrainsAppendTestCase are destructive, let's
just wrap the whole class test case.
Because the tests themselves as well as the `tearDown` function were
wrapped in a @destructiveTest decorator, some test errors were printing
in the test output when --run-destructive isn't passed at the CLI.
This fixes those test errors.
* Fixing integration tests if azure is not present
* Fixing integration tests failures if 'git' command is missing
Skip git state integration tests if 'git' does not exists
Prevent OSError if 'git' command not found during _git_version()
* Fix PillarModuleTest::test_pillar_items: 'info' does not exist in pillar
* Fixing integration tests if azure is not present
* Fixing integration tests failures if 'git' command is missing
Skip git state integration tests if 'git' does not exists
Prevent OSError if 'git' command not found during _git_version()
* Shut down time sync before setting time in tests
* Lint
* Revert "Lint"
This reverts commit 6e3e6b76908b2c79647c7840fc3981548b2d13fc.
* Lint fix (ugh)
I think that what is happening here is that we're using stale grains from a previous test. This should hopefully refresh them and allow this test to succeed.
* salt/crypt.py: clean up open filehandles
* salt/fileclient.py: clean up open filehandles
* salt/grains/core.py: clean up open filehandles
* salt/modules/cp.py: clean up open filehandles
* salt/modules/data.py: clean up open filehandles
* salt/modules/dnsutil.py: clean up open filehandles
* salt/modules/dockerng.py: clean up open filehandles
* salt/modules/inspectlib/collector.py: clean up open filehandles
* salt/modules/file.py: clean up open filehandles
* salt/modules/hosts.py: clean up open filehandles
* salt/modules/incron.py: clean up open filehandles
* salt/modules/dpkg.py: clean up open filehandles
* salt/modules/linux_sysctl.py: clean up open filehandles
* salt/modules/netbsd_sysctl.py: clean up open filehandles
* salt/modules/network.py: clean up open filehandles
* salt/modules/nftables.py: clean up open filehandles
* salt/modules/openbsd_sysctl.py: clean up open filehandles
* salt/modules/rh_ip.py: clean up open filehandles
* salt/modules/portage_config.py: clean up open filehandles
* salt/modules/status.py: clean up open filehandles
* salt/modules/tls.py: clean up open filehandles
* salt/modules/xapi.py: clean up open filehandles
* salt/modules/x509.py: clean up open filehandles
* salt/modules/virt.py: clean up open filehandles
* salt/modules/zcbuildout.py: clean up open filehandles
* salt/returners/local_cache.py: clean up open filehandles
* salt/utils/cloud.py: clean up open filehandles
* salt/states/pkgrepo.py: clean up open filehandles
* salt/states/x509.py: clean up open filehandles
* salt/transport/mixins/auth.py: clean up open filehandles
* salt/utils/__init__.py: clean up open filehandles
* salt/states/pkg.py: clean up open filehandles
* salt/utils/minion.py: clean up open filehandles
* salt/utils/openstack/nova.py: clean up open filehandles
* salt/utils/openstack/swift.py: clean up open filehandles
* salt/utils/process.py: clean up open filehandles
* salt/utils/templates.py: clean up open filehandles
* salt/utils/virt.py: clean up open filehandles
* tests/integration/__init__.py: clean up open filehandles
* tests/integration/cli/grains.py: clean up open filehandles
* tests/integration/client/standard.py: clean up open filehandles
* tests/integration/modules/hosts.py: clean up open filehandles
* tests/unit/utils/vt_test.py: clean up open filehandles
* tests/integration/shell/enabled.py: clean up open filehandles
* tests/integration/states/cmd.py: clean up open filehandles
* tests/integration/states/file.py: clean up open filehandles
* tests/integration/states/match.py: clean up open filehandles
* tests/unit/config_test.py: clean up open filehandles
* tests/unit/templates/jinja_test.py: clean up open filehandles
* tests/unit/utils/find_test.py: clean up open filehandles
* tests/integration/modules/state.py: clean up open filehandles
* Update dnsutil_test to reflect changes in fopen usage