zester
GuidesModules

test

The test.* family of state modules.

ModuleSummary
test.configurable_test_stateResult and change reporting fully driven by config.
test.fail_without_changesAlways fails, reporting no changes.
test.nopA no-op that always succeeds and reports no changes.
test.pingA simple liveness check that always succeeds.
test.succeed_with_changesAlways succeeds and reports that changes were made.

All states also accept the full set of requisite parameters and Salt-parity state attributes — see Dependencies & Requisites.


test.configurable_test_state

Result and change reporting fully driven by config.

Source: pkg/state/modules/test/test_configurable_test_state.go


test.configurable_test_state lets a state file dial in an exact outcome: result selects success or failure and changes selects whether a change is reported — each defaulting to true. Check always forces Apply, so the configuration alone controls the reported result. comment customizes the message (and, on failure, the error).


Parameters

ParameterTypeRequiredDefaultDescription
resultboolNotruewhether the state succeeds; false makes it fail (with the comment message, or "configured failure"); defaults to true; a boolean that also accepts the integers 1 (true) and 0 (false)
changesboolNotruewhether the state reports Changed: true (honored on both success and failure); defaults to true; a boolean that also accepts the integers 1 (true) and 0 (false)
commentstringNo(none)message included in the result details and, on failure, the error

Effects

Check

Always reports that a change is needed so Apply runs and fully controls the reported outcome.

Apply

When result is true, succeeds with Changed set to changes and Details {"result": "true"} (plus comment when set). When result is false, fails: returns an error carrying comment (or configured failure) together with Changed set to changes and Details {"result": "false"} (plus comment when set) — so a change and the comment can be reported on failure too.

Revert

No-op (Changed: false).


Examples

Succeed without reporting a change

result true + changes false models a healthy, unchanged resource.

scenario:
  test.configurable_test_state:
    - result: true
    - changes: false
    - comment: "healthy, nothing changed"

See Also


test.fail_without_changes

Always fails, reporting no changes.

Source: pkg/state/modules/test/test_fail_without_changes.go


test.fail_without_changes always fails and reports no changes — useful for testing onfail chains and failure propagation. The comment parameter customizes the error message; when omitted the built-in message failure without changes is used.


Parameters

ParameterTypeRequiredDefaultDescription
commentstringNo(none)message included in the error and result details; defaults to "failure without changes"

Effects

Check

Always reports that a change is needed so Apply runs and the failure is surfaced.

Apply

Always fails: returns an error carrying comment (or failure without changes when unset) together with Details {"result": "false", "comment": <message>}, and Changed: false.

Revert

No-op (Changed: false).


Examples

Simulate a failure

The comment becomes the error message.

simulated-failure:
  test.fail_without_changes:
    - comment: "primary service unavailable"

See Also


test.nop

A no-op that always succeeds and reports no changes.

Source: pkg/state/modules/test/test_nop.go


test.nop is a placeholder state that always succeeds and reports no changes. Check reports the state as already satisfied, so under normal ordering Apply does not even run — useful as a requisite anchor or an inert placeholder.


Parameters

This module takes no parameters of its own.


Effects

Check

Reports NeedsChange: false — the state is always already satisfied, so the runner normally skips Apply entirely.

Apply

If reached (for example via a watch-forced apply), performs no work: returns Changed: false with Details {"result": "true"}.

Revert

No-op (Changed: false).


Examples

An inert placeholder

test.nop is satisfied immediately and never touches the system.

placeholder:
  test.nop: []

See Also


test.ping

A simple liveness check that always succeeds.

Source: pkg/state/modules/test/test_ping.go


test.ping is a no-op "are you alive?" check — the Zester equivalent of Salt's test.ping. It takes no parameters of its own and always succeeds, returning {"result": "true"} in its result details.


Parameters

This module takes no parameters of its own.


Effects

Check

Always reports that a change is needed, so the runner proceeds to Apply and the result is returned.

Apply

Performs no work: returns Changed: false with Details {"result": "true"}.

Revert

No-op (Changed: false) — there is nothing to undo.


Examples

Ping all peels

The bare invocation checks liveness across every matched peel.

zester '*' test.ping

Ping a specific peel

Target a single peel by id.

zester 'web-01' test.ping

See Also


test.succeed_with_changes

Always succeeds and reports that changes were made.

Source: pkg/state/modules/test/test_succeed_with_changes.go


test.succeed_with_changes always succeeds and reports Changed: true — useful for testing watch and onchanges chains. The optional comment parameter is included in the result details when set.


Parameters

ParameterTypeRequiredDefaultDescription
commentstringNo(none)optional message included in the result details

Effects

Check

Always reports that a change is needed so Apply runs.

Apply

Always succeeds with Changed: true and Details {"result": "true"} (plus comment when set).

Revert

No-op (Changed: false).


Examples

Simulate a change

The state always reports Changed: true.

simulated-change:
  test.succeed_with_changes: []

See Also

On this page