question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support tasks tagged molecule-idempotence-nofail, similar to molecule-idempotence-notest

See original GitHub issue

Proposal: <proposal name>

Author: Nik Reiman <@nre-ableton> IRC: N/A

Date: 2020/07/28

  • Status: New
  • Proposal type: Enhancement
  • Estimated time to implement: Unknown

Motivation

I would like to use Molecule to test roles which have tasks that are not idempotent, but also not have the idempotency task fail or be required to mark such tasks with the changed_when: false attribute.

A bit more background – I have some Ansible roles which install and configure rather complex services (in this case, Jenkins and Jenkins build nodes via Swarm Client). Before these roles can be safely run, these services must be stopped. Then, several tasks are run to configure the host, and then the service is restarted. It is impossible (or rather, extremely difficult and/or very impractical) to determine idempotency before shutting down the service, and therefore the most practical way to proceed is to stop the service, run the tasks, and then start it up again at the end of the role.

Ideally, I want molecule to alert me when the intermediate tasks are non-idempotent. Therefore, disabling the idempotency check entirely is not a desirable solution. Also, I need molecule to actually run the service tasks, so molecule-idempotence-notest will not work since this skips them altogether. Ideally, I wish I could tag such tasks with a tag named something like molecule-idempotence-nofail. Such tasks should be run by molecule, but the idempotency check will not fail if molecule sees that they have changed the system state.

I’m not sure how difficult or practical this will be to implement, since I’ve not looked into the molecule codebase at all. If this feature is not desired by the community or would be very hard to implement , I’ll close this issue. If it is easy to moderately hard to implement, then I’ll take a look at the code and see if I can come up with a PR.

Problems

What problems exist that this proposal will solve?

  • Allowing tasks which are known to change system state to be run, and not fail idempotency tests

Solution proposal

Unknown

Dependencies (optional)

N/A

Testing (optional)

I’m assuming that test cases would be fairly trivial to implement for such a feature.

Documentation (optional)

Ideally this should be documented alongside molecule-idempotence-notest here.

Anything else?

I’m relatively new to molecule and haven’t contributed before. Apologies for my n00b-ness. 😅

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sjpbcommented, Jul 15, 2021

Interesting. Found this issue, thought “oh molecule-idempotence-notest will solve it”, then found it skips the tasks entirely! My usecase - which can’t be that uncommon? - is that I’m creating a tempfile and doing stuff with it. So that isn’t idempotent as the tempfile is different everytime (and it needs to be unique, in this case, so I don’t want to hard-code it) but I want molecule to not fail! Use of changed_when is maybe philosophical but it doesn’t seem right to have ansible mark this as no-change in the real environment just because of a testing limitation.

2reactions
greg-hellingscommented, Oct 23, 2020

Oh this is a feature I would love to have. I’ve toyed with the idea of adding a flag to the molecule.yml to just completely skip idempotence checking altogether. I’ve settled on just adding “changed_when: false” to tasks that trigger problems, but sometimes that’s just not appropriate. Most common times I have this issue is with calls to tempfile. Sometimes command/shell as well, depending on what they’re doing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preserve Tagging After Project/Task Duplication
What I would like to be able to do is tag a task in a template to a particular folder (Teams, for example)....
Read more >
Maximize your organization across queues using tags
Maximize your organization across queues using tags. Search for similar tasks from different categories to help plan your work and optimize your schedule....
Read more >
Tagging your AWS DataSync tasks
Learn how to apply tags to your AWS DataSync tasks. ... Tags are key-value pairs that help you manage, filter, and search for...
Read more >
Manage task tags - ClickUp Help
Create, edit, and delete tags on tasks to organize your work! Task tags are different than Doc tags. Check out this article if...
Read more >
Using Tags - Things Support - Cultured Code
Create Tags for these categories, then use them to filter long lists so that you can focus on similar work. In this article:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found