Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

consistency tests #15

Closed
wants to merge 1 commit into from
Closed

consistency tests #15

wants to merge 1 commit into from

Conversation

PietroPasotti
Copy link
Owner

This PR adds a new test suite aimed at validating the output of the simulated backend against the output of the real hook tools.

tests/consistency/conftest.py exposes a compare function to be used like:

compare("relation_list", "relation_name").

this will compare the _MockModelBackend result against the result of, essentially, running juju exec -u some-unit/0 -m some-model -- relation-list relation_name.

If the hook tool call returns an error code, wrapped by _ModelBackend in an ops.model.ModelError, compare() checks that _MockModelBackend raises a similar error.

If the hook tool call returns a value, compare() checks that _MockModelBackend returns the exact same value as _ModelBackend.

For now this works with a hardcoded model and unit name, and the State used by _MockModelBackend is also hardcoded.

Next steps:
create a testing charm (or bundle?) to pack and deploy using pytest-operator, and a corresponding State. Or pick a reference charm/bundle to deploy and test with. Probably best.

@PietroPasotti
Copy link
Owner Author

transferred to canonical/ops-scenario#2

@PietroPasotti PietroPasotti deleted the test-with-real-juju branch February 15, 2023 09:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant