Skip to content

Commit

Permalink
Include certain deprecation warnings on tests
Browse files Browse the repository at this point in the history
Due to some of the versions of dependencies we're using, these tests may
emit some specific errors.
  • Loading branch information
waynew authored and Megan Wilhite committed Jan 10, 2023
1 parent 51f5610 commit 3f2e32a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 4 deletions.
28 changes: 26 additions & 2 deletions tests/pytests/integration/cli/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,19 @@ def test_batch_retcode(salt_cli, salt_minion, salt_sub_minion, run_timeout):
)

assert cmd.returncode == 23
assert not cmd.stderr
# TODO: Certain platforms will have a warning related to jinja. But
# that's an issue with dependency versions that may be due to the versions
# installed on the test images. When those issues are sorted, this can
# simply `not cmd.stderr`.
assert (
not cmd.stderr
or cmd.stderr.endswith(
"jinja.py:736: DeprecationWarning: 'contextfunction' is renamed to 'pass_context', the old name will be removed in Jinja 3.1.\n @contextfunction\n"
)
or cmd.stderr.endswith(
"process.py:54: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats\n current = setproctitle.getproctitle()\n"
)
)
assert "true" in cmd.stdout


Expand All @@ -198,7 +210,19 @@ def test_multiple_modules_in_batch(salt_cli, salt_minion, salt_sub_minion, run_t
)

assert cmd.returncode == 23
assert not cmd.stderr
# TODO: Certain platforms will have a warning related to setproctitle. But
# that's an issue with dependency versions that may be due to the versions
# installed on the test images. When those issues are sorted, this can
# simply `not cmd.stderr`.
assert (
not cmd.stderr
or cmd.stderr.endswith(
"process.py:54: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats\n current = setproctitle.getproctitle()\n"
)
or cmd.stderr.endswith(
"jinja.py:736: DeprecationWarning: 'contextfunction' is renamed to 'pass_context', the old name will be removed in Jinja 3.1.\n @contextfunction\n"
)
)


def test_batch_module_stopping_failed_respond(
Expand Down
46 changes: 44 additions & 2 deletions tests/pytests/scenarios/daemons/test_salt_as_daemons.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,28 @@ def test_salt_master_as_daemon(salt_master_factory):
pass
finally:
assert salt_master_factory.impl._terminal_result.stdout == ""
assert salt_master_factory.impl._terminal_result.stderr == ""
# TODO currently setproctitle.getproctitle warns on some platforms.
# It's fine, actually, for that warning to show up, until the
# correct versions are configured for those platforms. When they
# are, the 'if not all(...):' line should be removed and just the
# assertion that `stderr == ""` should be left.
if not any(
(
all(
text in salt_master_factory.impl._terminal_result.stderr
for text in ("PY_SSIZE_T_CLEAN", "salt/utils/process.py:54")
),
all(
text in salt_master_factory.impl._terminal_result.stderr
for text in (
"salt/utils/jinja.py:736",
"contextfunction",
"pass_context",
)
),
)
):
assert salt_master_factory.impl._terminal_result.stderr == ""
assert salt_master_factory.impl._terminal_result.returncode == 0

# We are going to kill the possible child processes based on the entire cmdline
Expand Down Expand Up @@ -61,7 +82,28 @@ def test_salt_minion_as_daemon(salt_minion_factory):
pass
finally:
assert salt_minion_factory.impl._terminal_result.stdout == ""
assert salt_minion_factory.impl._terminal_result.stderr == ""
# TODO currently setproctitle.getproctitle warns on some platforms.
# It's fine, actually, for that warning to show up, until the
# correct versions are configured for those platforms. When they
# are, the 'if not all(...):' line should be removed and just the
# assertion that `stderr == ""` should be left.
if not any(
(
all(
text in salt_minion_factory.impl._terminal_result.stderr
for text in ("PY_SSIZE_T_CLEAN", "salt/utils/process.py:54")
),
all(
text in salt_minion_factory.impl._terminal_result.stderr
for text in (
"salt/utils/jinja.py:736",
"contextfunction",
"pass_context",
)
),
)
):
assert salt_minion_factory.impl._terminal_result.stderr == ""
assert salt_minion_factory.impl._terminal_result.returncode == 0

# We are going to kill the possible child processes based on the entire cmdline
Expand Down

0 comments on commit 3f2e32a

Please sign in to comment.