Run all scenarios

49 views
Skip to first unread message

himansh...@gmail.com

unread,
Jul 22, 2020, 12:44:17 AM7/22/20
to molecule-users
Hi,

I have a requirement where all scenarios needs to be executed even if preceding scenario fails.

Current behavior of molecule doesn't allows it.

For an example, below is a sample test matrix with test sequence

--> Test matrix
   
├── scenario_1
│   ├── lint
│   └── converge
└── scenario_2
    ├── lint
    └── converge
   
If scenario 1 fails for some reason (e.g. assertion failure) scenario 2 doesn't run as ansible-playbook
command error-ed out.

Don't want to use ignore_errors attribute.

Molecule
molecule 3.0.6
   ansible==2.9.3 python==3.6

Thanks

   

syhR8

unread,
Jul 22, 2020, 2:05:35 AM7/22/20
to himansh...@gmail.com, molecule-users
You could just loop over the scenarios with Bash

--
You received this message because you are subscribed to the Google Groups "molecule-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to molecule-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/molecule-users/adc75c01-5bee-4cf4-9512-e84c5c36d89eo%40googlegroups.com.

John Dewey

unread,
Jul 22, 2020, 2:06:56 AM7/22/20
to syhR8, himansh...@gmail.com, 'syhR8' via molecule-users

himansh...@gmail.com

unread,
Jul 22, 2020, 2:37:54 AM7/22/20
to molecule-users
that is one solution but IMO it should be supported by molecule itself.


On Wednesday, 22 July 2020 16:05:35 UTC+10, syhR8 wrote:
You could just loop over the scenarios with Bash

<himans...@gmail.com> schrieb am Mi., 22. Juli 2020, 06:44:
Hi,

I have a requirement where all scenarios needs to be executed even if preceding scenario fails.

Current behavior of molecule doesn't allows it.

For an example, below is a sample test matrix with test sequence

--> Test matrix
   
├── scenario_1
│   ├── lint
│   └── converge
└── scenario_2
    ├── lint
    └── converge
   
If scenario 1 fails for some reason (e.g. assertion failure) scenario 2 doesn't run as ansible-playbook
command error-ed out.

Don't want to use ignore_errors attribute.

Molecule
molecule 3.0.6
   ansible==2.9.3 python==3.6

Thanks

   

--
You received this message because you are subscribed to the Google Groups "molecule-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to molecul...@googlegroups.com.

himansh...@gmail.com

unread,
Jul 22, 2020, 2:39:01 AM7/22/20
to molecule-users
that was the command , it doesn't execute next scenario if preceding scenario fails


On Wednesday, 22 July 2020 16:06:56 UTC+10, John Dewey wrote:
`molecule test —all`


On July 21, 2020 at 11:05:35 PM, 'syhR8' via molecule-users (molecul...@googlegroups.com) wrote:

You could just loop over the scenarios with Bash

<himans...@gmail.com> schrieb am Mi., 22. Juli 2020, 06:44:
Hi,

I have a requirement where all scenarios needs to be executed even if preceding scenario fails.

Current behavior of molecule doesn't allows it.

For an example, below is a sample test matrix with test sequence

--> Test matrix
   
├── scenario_1
│   ├── lint
│   └── converge
└── scenario_2
    ├── lint
    └── converge
   
If scenario 1 fails for some reason (e.g. assertion failure) scenario 2 doesn't run as ansible-playbook
command error-ed out.

Don't want to use ignore_errors attribute.

Molecule
molecule 3.0.6
   ansible==2.9.3 python==3.6

Thanks

   

--
You received this message because you are subscribed to the Google Groups "molecule-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to molecul...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "molecule-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to molecul...@googlegroups.com.

himansh...@gmail.com

unread,
Jul 26, 2020, 6:24:00 PM7/26/20
to molecule-users
Hi,

Should this be considered as a bug or an expected behavior?

After looking into the code, it looks like the current behavior is happening in here ( ansible_playbook.py )

Line number: 105 : molecule delegates the call invoking ansible-playbook command and fails
Line number: 109 : exits hence not running the next scenario

 90     def execute(self):
 
91         """
 92         Execute ``ansible-playbook`` and returns a string.
 93
 94         :return: str
 95         """

 
96         if self._ansible_command is None:
 
97             self.bake()
 
98
 
99         if not self._playbook:
100             LOG.warning("Skipping, %s action has no playbook." % self._config.action)
101             return
102
103         try:
104             self._config.driver.sanity_checks()
105             cmd = util.run_command(self._ansible_command, debug=self._config.debug)
106             return cmd.stdout.decode("utf-8")
107         except sh.ErrorReturnCode as e:
108             out = e.stdout.decode("utf-8")
109             util.sysexit_with_message(str(out), e.exit_code)
110


Reply all
Reply to author
Forward
0 new messages