This makes some further tweaks to make the test more stable under heavy
load. Firstly, the background job sleeps longer, and secondly, we make
up to 3 attempts run state.running instead of just the one, in case our
first attempt was too early. It also uses threading to make the job
sleep, since the method of adding a & to the command seemed to be
producing intermittent failures with returning clean JSON.
These failures were recently introduced but went undiscovered due to
some recent instability in the test suite (which has now been fixed).
This commit fixes these failing tests.
https://github.com/saltstack/salt/pull/45583 was opened to fix some test
failures in the daemons tests. However, with the way that the tests were
written, `_multiproc_exec_test` was waiting for a response from the
child function, which would never come due to the error raised during
the test. This means that any exception raised during the test would
stop the test suite dead in its tracks, causing it to eventually end in
a timeout.
This commit addresses this design flaw by wrapping the test logic in a
try/except, and ensuring that we always return a response from the child
function. The tests will instead log the exception and gracefully fail
the test, allowing whomever troubleshoots the failures to consult the
salt-runtests.log to see the traceback.
This adds a unicode_literals import to the fileserver code, and also ensures
that we return unicode paths from the serialized file/env list caches
(which when deserialized are still encoded str types on PY2).
It also adds a test and modifies a few other existing tests to confirm
that unicode paths/envs are returned *as unicode* in the return data.
This can happen in the test suite while running
integration.ssh.test_state.SSHStateTest.test_state_running because the
instance of salt-ssh running in the background has completed during the
second salt-ssh run, and since the contents of the thin tarball haven't
changed between runs, the checksum used to derive the path of the thin
tarball hasn't changed, so it is unlinked before the 2nd salt-ssh run in
that test completes.
This adds the ability to specify the encoding and error behavior. It
also adds the "errors" argument to the salt.utils.stringutils funcs for
converting between str, unicode, and bytes.
Tests have also been updated to properly test the recursive behavior of
salt.utils.data.decode/encode.
When str.format() was removed from this log message in 685bfbb, the
order of arguments was not changed, which causes the info log to not
make sense. This corrects that oversight.