preloader

Salt Check

Overview

salt-check is a module to run tests on your States and confirm they applied successfully.

Layout

  STATENAME/
    /init.sls
      /saltcheck-tests/
        /STATENAME.tst

CLI

  • Run a single test from the Master
salt '*' saltcheck.run_state_tests MyState
  • Run all tests from the Master
salt '*' saltcheck.run_highstate_tests
  • Run a single test from a Minion
salt-call saltcheck.run_state_tests MyState
  • Run all tests from the Minion
salt-call saltcheck.run_highstate_tests

Tests

  • An example for testing users
{% for user in pillar.get('users', {}) %}

Test {{ user.account }}:
  module_and_function: user.list_users
  args:
  kwargs:
  pillar-data:
  assertion:  assertIn
  expect-return: {{ user.account }}

{% endfor %}