Comments (6)
Thanks for this, and to anyone finding this in the future, you can add it to your sequence in molecule.yml with:
scenario:
name: default
test_sequence:
- lint
- destroy
- dependency
- syntax
- create
- prepare
- converge
- idempotence
# Added --check run test.
- check
- side_effect
- verify
- destroy
from molecule.
If we are to add
check
into the test sequence. Where would it go? It doesn't make sense to run it after converge, since nothing would then change.
Adding after converge
actually does make sense, although it's not intuitive. Many roles use a command/register pragma to store a dynamic variable, then inspect that var in a subsequent task as part of conditional logic. By default, Ansible skips command
tasks, because it can't know the severity of side-effects, so the subsequent tasks inspecting the var will fail in check mode. Having Molecule run a check mode after converge would be very useful to catch errors like this.
It's technically possible to support dry-runs of a first-time role run with Ansible, but I don't see many role authors striving for it. For example, get_url
tasks will be skipped by default, and then any tasks referencing a file downloaded by get_url
will fail, since the file doesn't exist. A reasonable order for running --check mode seems to be:
- destroy
- syntax
- create
- converge
- idempotence
- check
- verify
If you run check
before converge
, I'd wager that most Ansible roles would fail, since folks simply don't plan for that use case.
from molecule.
Implemented in #201.
from molecule.
@retr0h The --check
and --syntax-check
arguments to ansible-playbook are distinct—looks like #201 adds the --syntax-check
functionality as molecule check
. That's fine, but it's not the same thing as --check
, which performs a dry-run of the playbook.
from molecule.
Opening
from molecule.
@conorsch I think I'm going to need more details on this. I'm not entirely sure how it would be helpful.
If we are to add check
into the test sequence. Where would it go? It doesn't make sense to run it after converge, since nothing would then change.
Since change
always returns success, I don't see how it would be useful in the test sequence. I can implement the changed
subcommand, but not add it to the test sequence. People can then do what they wish with it?
from molecule.
Related Issues (20)
- Update documentation about default Driver HOT 1
- [Docs] Update user guide with missing sections HOT 4
- [Docs] Add porting guide HOT 1
- dependency step installs roles to user's roles path, not in ephemeral directory HOT 3
- CRITICAL 'molecule/default/molecule.yml' glob failed. Exiting - Unable to run molecule HOT 13
- Unknown command: ansible-playbook
- Switch Releases to CalVer HOT 1
- molecule matrix command produces unreadable colored output HOT 1
- Container drivers are not working
- Is `v24.2.0` wrongly tagged? HOT 1
- wants tmpfs to be dict, not list HOT 8
- Molecule config file in {project}/.config/molecule/config.yml not found HOT 1
- Molecule instance inherits all groups from inventory
- [Docs] Add driver name for podman HOT 2
- The env option of the shell dependency has no effect
- Unable to Create Temporary Directory During Molecule Test Execution in Ansible Role HOT 2
- Molecule converge with specific scenario ends up with an error HOT 1
- The molecule with docker driver doesn't work with requests lib => 32.x.x HOT 1
- Project cleanup
- Getting 404 errors from github while trying to install roles HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from molecule.