Molecule#76
Conversation
1ed0af0 to
67cfec6
Compare
|
@simon-ess: Can you rebase this? I mainly want to trigger a new CI run, since the CI has changed drastically since you created the PR. With #88 requesting many changes only tested on one flavor, I would love to know how and be able to add tests. |
|
Ah, thanks for reminding me. I will look at this tomorrow. |
There was a problem hiding this comment.
This is unrelated to Molecule, isn't it?
There was a problem hiding this comment.
Not exactly. Molecule testing includes a test that playbooks and roles are idempotent; by its very nature running a shell task cannot be ensured to be idempotent so it will always fail that (unless you have changed_when: false which is not my prefered way of handling things). The idea here is to use some actual ansible modules to perform the same action so that idempotence can pass.
There was a problem hiding this comment.
Well, let me improve my wording, then.
This is not related to adding Molecule, but fixes an issue that Molecule would find, correct?
(So it could be extracted and merged independently. Just trying to understand.)
There was a problem hiding this comment.
Ah, yes. I suppose it's a general thing when adding tests that you find things that need to be fixed and include them with the changes :D
What does that mean?! |
|
I have rebased this, but it will take a bit of work to get going correctly. The problem is that these roles are not something that can be run in isolation as they currently depend on variables defined outside of their scope. I'll see what I can do to clean this up, but it may involve a bit more refactoring of the roles themselves... |
|
Regarding the role name, it seems that hyphens are a no-go: https://docs.ansible.com/projects/lint/rules/role-name/ I will change the names of the roles to |
32082e8 to
1dcd9c7
Compare
|
Ok, this passes now and seems to be testing base and the initial setup. It wasn't as bad as I feared! A few notes to ponder when reviewing this:
Testing is still pretty limited, but could of course be expanded. This is more an initial PoC. |
|
Ack.
|
|
It's sort of nice, but it makes the roles hard to test on their own since the playbook was setting those variables. As I understand it it is more ansible-idiomatic to directly query the facts, or if necessary for something like But as for role names, I'm a bit perplexed by this as well. The roles at ESS are all named something like |
|
Should I rename all the roles in a separate commit - and then drop the commit in this PR on rebasing it? Or rename all remaining roles in a separate commit? |
|
I'm fine either which way tbh. Your call. I can also rename everything in the commit in this PR... |
|
Would you be willing to do that? Great. |
|
I'll do it in one mega-commit then 😄 |
65d5bc0 to
b3d7fca
Compare
|
Ok, roles renamed and tests passing again. This could be ready for review/merge now. Some further thoughts, but maybe they belong in a further set of PRs:
|
|
Looks good! One last thing: |
Yessir. That's the idea! |
To be clear, you mean split those out so that you can squash this into two commits: renaming the roles, and everything else? |
Three simple tests: * RELEASE.local is created correctly * softIoc* are on path * EPICS tools are on path
The roles themselves should be responsible for the values that they need if they are to be tested independently; since most of the distro specific variables are only used in one or two roles, they can be moved to those roles. Note that we also add scoping prefixes to the variables to avoid potential collisions.
Ansible roles should only contain lowercase alphanumeric characters and underscores.
|
No. Just combine the "rename m-base" and "rename all roles" into one commit. |
Done. |
|
Thanks A LOT for preparing this. |
Starting steps to add molecule tests for the roles. Includes a github job to run the tests.