Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add args for verify and side_effect actions #3467

Merged
merged 2 commits into from
Mar 31, 2022
Merged

Conversation

amarao
Copy link
Contributor

@amarao amarao commented Mar 14, 2022

This feature allows to provide alternative location for
tests or side effects playbook in test sequence like this:

  test_sequence:
    - create
    - converge
    - verify
    - side_effect side_effect1.yml
    - verify tests_for_effect1/
    - side_effect side_effect2.yml
    - verify tests_for_effect2/

This allows to create more comprehensive tests for
resulting system, allowing, in particular, to check
if it's works as intended, f.e.:

  • after server reboot
  • after applying system changes and reverting them back
  • after introducing external stress

Classic approach with one-side-effect per scenario can create
high overhead for both converge operations (if they are long),
and maintenance (because each scenario directory need to be
kept up-to-date).

This patch keep original behavior intact. If no arguments
are provided to verify and side_effect actions, they uses
values from molecule.yml. If there is action argument, they

  • replace side effect playbook with list of playbooks after
    side_effect action (in molecule.yml), relative to molecule.yml file.
  • replace tests (and additional_files_or_dirs) with list of
    locations (relative to molecule.yml), while keeping
    all other test settings intact. This is supported for both
    verifiers (testinfra and ansible).

@amarao amarao marked this pull request as draft March 15, 2022 09:22
@amarao amarao marked this pull request as ready for review March 15, 2022 15:09
@amarao amarao force-pushed the action_args branch 2 times, most recently from d0693f1 to 529a7ea Compare March 15, 2022 15:30
@amarao
Copy link
Contributor Author

amarao commented Mar 16, 2022

I have no permissions to set tags on PR. It's ready for review, tests are green.

feat: add args for verify and side_effect actions

This feature allows to provide alternative location for
tests or side effects playbook in test sequence like this:
```
  test_sequence:
    - create
    - converge
    - verify
    - side_effect side_effect1.yml
    - verify tests_for_effect1/
    - side_effect side_effect2.yml
    - verify tests_for_effect2/
```

This allows to create more comprehensive tests for
resulting system, allowing, in particular, to check
if it's works as intended:
* after server reboot
* after applying system changes and reverting them back
* after introducing external stress

Classic approach with one-side-effect per scenario can create
high overhead for both converge operations (if they are long),
and maintenance (because each scenario directory need to be
kept up-to-date).

This patch keep original behavior intact. If no arguments
are provided to verify and side_effect actions, they uses
values from molecule.yml. If there is action argument, they
* replace side effect playbook with list of playbooks after
  `side_effect` action (in molecule.yml), relative to molecule.yml file.
* replace tests (and `additional_files_or_dirs`) with list of
  locations (relative to `molecule.yml`), while keeping
  all other test settings intact. This is supported for both
  verifiers (testinfra and ansible).

Signed-off-by: George Shuklin <george.shuklin@gmail.com>
@briantist
Copy link

wow, I really like this!

@ssbarnea ssbarnea changed the title [feat] add args for verify and side_effect actions Add args for verify and side_effect actions Mar 31, 2022
@ssbarnea ssbarnea requested a review from ziegenberg March 31, 2022 16:02
@ssbarnea ssbarnea merged commit 20f5407 into ansible:main Mar 31, 2022
@nkakouros
Copy link

This is not in the docs, right?

@apatard
Copy link
Contributor

apatard commented Jun 17, 2022

@nkakouros unfortunately, it would not be the first time updating the doc is forgotten. If you have time, a PR with a doc update would be nice or at least, please open a bug report to make sure that it's not forgotten / lost ?

@nkakouros nkakouros mentioned this pull request Jun 17, 2022
rbrunckhorst referenced this pull request in meffie/molecule-robotframework Jun 21, 2022
Molecule 4.0.0 makes some breaking changes, so limit our version
to 3.x until we catch up.
kannanr added a commit to kannanr/molecule-inspec that referenced this pull request Aug 31, 2022
ansible/molecule#3467 adds action_args to self._config.verifier.execute at verify.py line 74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants