Skip to content

Saltcheck allow multiple asserts against module output#56101

Merged
dwoz merged 8 commits intosaltstack:masterfrom
mchugh19:multi-assert
Apr 22, 2020
Merged

Saltcheck allow multiple asserts against module output#56101
dwoz merged 8 commits intosaltstack:masterfrom
mchugh19:multi-assert

Conversation

@mchugh19
Copy link
Contributor

@mchugh19 mchugh19 commented Feb 9, 2020

What does this PR do?

Allows saltcheck tests to specify multiple assertions against module output

Previous Behavior

A saltcheck tests could only be defined like

test with complicated output:
  module_and_function: network.netstat
  assertion: assertEqual
  assertion_section: "0:program"
  expected_return: "systemd-resolv"
  output_details: True
  print_result: True

New Behavior

By creating a list under an assertions key, multiple asserts can be run

multiple checks on complicated output:
  module_and_function: network.netstat
  assertions:
    - assertion: assertEqual
      assertion_section: "0:program"
      expected_return: "systemd-resolve"
    - assertion: assertEqual
      assertion_section: "0:proto"
      expected_return: "udp"
  output_details: True
  print_result: True

Multiple assertions can be run against the output of a single module_and_function call. The assertion, expected_return, assertion_section, and assertion_section_delimiter keys can be placed in a list under an assertions key.

Tests written?

Yes

@mchugh19 mchugh19 requested a review from a team as a code owner February 9, 2020 12:18
@ghost ghost requested a review from twangboy February 9, 2020 12:18
@mchugh19
Copy link
Contributor Author

re-run pr-ubuntu1604-py3-pycryptodomex

@Ch3LL Ch3LL removed the request for review from a team April 15, 2020 14:22
@mchugh19
Copy link
Contributor Author

re-run pr-windows2019-py3

@dwoz dwoz requested a review from waynew April 20, 2020 07:56
@dwoz dwoz merged commit e8d00c6 into saltstack:master Apr 22, 2020
@sagetherage sagetherage added the ZRelease-Sodium retired label label May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ZRelease-Sodium retired label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants