The existing fix did not work if the profile name itself had a dash `-`.
For example - `virtual-guest`. This commit fixes that by using `split('- ')`
rather than `split('-')`. This commit also provides two simple tests for the
`list_()` function to emulate behaviour of both old and new tuned-adm versions
Fixes#39692
When we hit that attribute error, we need to set the docker version
variable to a tuple starting with 0 so we can use it in other test
comparisons. If docker is installed, but at a lower version, we will
see this attribute error.
Fixes the test failure on the 2016.11 branch on CentOS 6 VMs.
Also remove unused and unnecessary behavior from this function when the
first path component is of single length. An empty first parameter to
this function will normalze to "." and result in an incorrectly-joined
result.
Now that we are not caching these in the context dunder, we should pass
them into this function so that we don't repeat gathering the systemd
services inside _get_sysv_services().
Also, this fixes an incorrect change to the mocking that was apparently
made at some point to the get_all unit test.
Alternatives should say it is setting the symlink to `path` instead of
`current` which it is already set to
ssh_auth.absent should say it is going to remove the key, unless the status is
set to `add`, then it is already absent
Fixes#40322Fixes#40321
The tests pass fine when run independently, but when the full unit test suite
runs, the dockerng state tests are setting global values. This change makes the
module tests avoid those problem by relying on its own mocks.
The tornado web aplication that was set up in the archive tests, and then
duplicated in the remote file integration tests, starts the web server,
but never stops it. This creates a stacktrace that hangs the other test
file that attempts to start the web server.
The Application class has a `listen()` function, but not a `stop()` function.
The change uses the `HTTPServer` class to set up the listening server, but
also has the necessary `stop()` function. (The `listen()` function from the
`Application` class just calls out to the `HTTPServer`'s `listen()` function,
so this works nicely here.)
We can then call the `stop()` function in the `tearDownClass` class method.
I also removed some duplicate STATE_DIR definitions.
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.
The type of the ``path`` value changed in #38188.
This updates the type in the unit test, as well as rearranges some
of the imports to be more standardized with ``ensure_in_syspath``.
A recent PR of mine removed the logic in symlink_list and fell back to
the cached file list generated in _file_lists(). However, this code
dates back from before the fileserver backends' symlink_list() functions
were modified to return a dict mapping links to their destinations.
This fixes the code in _file_lists() so that it returns the correct
data. It also fixes the fact that '.' was showing up in the dir list
produced by _file_lists(), and updates the associated integration test
to include the cachedir in the mocked opts.
Version 2.6.0 changed the wording of one of the exceptions tested,
causing tests to fail when jsonschema 2.6.0 is installed. This commit
updates the tests to change the assert for 2.6.0 and later.
* Fix for #38697
* Lint fixes
* Added missing source_hash_name argument in get_managed function
Additional fix to #33187
Customer was still seeing errors, this should now work.
Tested with 2015.8.13 and 2016.11.2
* [2016.3] Pylint fix (#39202)
* Ignore empty dicts in highstate outputter
Closes#37174
* Sort the return list from the fileserver.envs runner
* Fix the win_ip_test failures (#39230)
The changes made in #38793 changes the "get_all_ointerfaces" call
to be a list of DNS servers. This change adjusts the tests structure
from a string to a list and fixes the test failure.
The changes made in #38793 changes the "get_all_ointerfaces" call
to be a list of DNS servers. This change adjusts the tests structure
from a string to a list and fixes the test failure.
* Apply fix from #38705 to 2016.3 branch
This is a better fix and covers more use cases than the sudo_user one.
* Remove saltenv param from internal state func call
This was probably redundant in the first place, but since state.sls,
state.highstate, etc. accept a saltenv param and the actual state
functions do not, this results in multiple values passed for the saltenv
param.
Remove this argument and let file.get_managed reference __env__
internally.
* Update archive tests to match 2016.11 branch
* Don't abort pillar.get with merge=True if default is None
This prevents a SaltInvocationError from being raised if the default is
loaded from a import_yaml jinja macro and the file being loaded is empty
(which is an entirely valid use case). In these cases, the loaded
default would be None, which we don't want to cause an exception.
* Add test case for issue 39062
This keeps trimmed output from failing the test. We are still testing
with a specific module lower down in the test, so this doesn't reduce
our test coverage.
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.
If all the devices submitted to pvcreate() are already initialized as
LVM physical volumes, pvcreate() should return True and no futher
actions should be made.
pvdisplay() would be called by pvcreate() twice: firstly to check
whether a device is already initialized for use by LVM and then to
ensure that the pvcreate executable did its job correctly. The test
replaces pvdisplay() with a mock that always returns True and thus
pvcreate() would think that a specified device is already initialized
and exit. In the other words, instead of testing physical volume
initialization the test simulates a case with all the submitted
devices already initialized.
Fix it by replacing pvdisplay with a mock that returns False on the
first call (thus pvcreate thinks that a device is not a PV yet) and True
on the second call (after the pvcreate executable is called).
'lvm version' produces multiline output whereas test_version and
test_fullversion use mocks with single-line output. Use real-life
'lvm version' output in those mocks instead.
Once this happens, we need to re-enable the test. The move over
should also allow us to upgrade the version of salt-testing that
is applied to the test VMs. Once this is complete, we can apply
the `@flaky` decorator to this test. (salt-testing must be a
version newer than the September release.)
The additional call to parser.parse_args(args) negates the first
patch to running self.config_func. We want the opts that we set
up in the above test to patch the setup args when the parse_args
func is called. This updates the mock to work with better with
patch and removes the additional parser.parse_args call.
Without this copy, the settings in DEFAULT_API_OPTS was getting overridden
by the new settings in the unit test. Let's copy those default settings,
and then restore them at the end of the test. These tests have also been
marked as destructive.