devtools module

This module contains several development tools

Debug output from the model

To print instances from the model, you can use devtools::debug::print

import std
import fs
import devtools::debug

host = std::Host(name="test")

for i in [1, 2]:
    fs::File(
        path=f"/tmp/test-{i}.txt",
        mode=777,
        owner="root",
        group="root",
        content=f"test-{i}",
        host=host,
        requires=[host],
    )
end

# Print the host entity
devtools::debug::print("host", host, waiters=host.provides, depth=2, now=true)

Mocking out handlers

To replace handlers with a mock that immediately succeeds use devtools::handler_mock::hook

e.g. To mock out all handlers in the ‘fs’ module, use

devtools::handler_mock::hook(["fs::"])

To disable mocking again, use

devtools::handler_mock::hook([])

When calling devtools::handler_mock::hook() (without arguments), it will mock every handler except the agent config and the lsm resources.

This mock should only be used in testing environments Once installed on an agent, it can remain there until it is disabled. This can lead to hard to diagnose issues if it is left behind.