-
Notifications
You must be signed in to change notification settings - Fork 15
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
Run Roles tests against Role/Collection installed from Ansible Galaxy #75
Conversation
812116b
to
d2d5f3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
@@ -71,7 +73,7 @@ function run_test_case { | |||
" | |||
docker exec "${ansible_cid}" bash -ec " | |||
cd tests | |||
py.test --junitxml=./junit/${test_case} --connection docker -v test_cases/${test_case}/tests/test_default.py | |||
py.test --junitxml=./junit/${test_case} --connection docker -v test_cases/common/test_default.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially my feedback was going to be. Let's add a comment up top to clarify why we avoid this folder, and a comment here to clarify that the common folder contains the code for the shared common test cases. Now I'm thinking that we should perhaps
- Have common folder that has those common test cases in test_default.py
- Retain the convention/interface of each test case needing to specify a
test_default.py
so that line 76 statys as
py.test --junitxml=./junit/${test_case} --connection docker -v test_cases/common/test_default.py
- In each test case's
test_default.py
it can just import (1)
RUN ansible-galaxy collection install cyberark.conjur && \ | ||
ansible-galaxy install cyberark.conjur-host-identity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure about this, some considerations...
- This repo should really be testing its own source code, instead of what is on Ansible Galaxy
- The standalone role is separate to the collection, and I think any test for it should reside in the standalone role's repo. All that to maintain a separation of concerns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For (1) I think if we want a smoke test to ensure that we can always install the role from galaxy then we should define that separate to the tests that currently exist.
- name: Configuring conjur identity on remote hosts from Role | ||
hosts: testapp | ||
roles: | ||
- role: cyberark.conjur-host-identity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea how this is still working given the role name constraints ?
Desired Outcome
An issue was reported in the Conjur docs regarding the Ansible Collection, described below.
The changes in this PR are intended to explicitly test use of the
conjur-host-identity
module installed from Ansible Galaxy, both individually and as part of the Conjur Collection.Issue Report Details
Environment:
Procedure:
Install the Conjur Ansible Collection:
Run the following playbook to set up a Conjur role:
This results in the following error:
The error was eventually resolved by using the individual Role instructions, meant for Ansible 2.8.
Issue Solution
The problem, in short:
Installing the Conjur Collection provides the role
cyberark.conjur.conjur_host_identity
, note the underscores (_
)Installing the standalone Role provides the role
cyberark.conjur-host-identity
, note the dashes (-
)From Ansible documentation on Role names:
The error here is in the documentation:
The solution here should be to release a new version of the standalone Role, where the naming convention is corrected, using underscores. This would include updating the documentation to reference the Role by each method with underscores.
Implemented Changes
Updates to
conjur-host-identity
testing:ansible
service indocker-compose
no longer mounts the repo for use in tests.configure-conjur-identity-from-collection
uses Collection-based Roleconfigure-conjur-identity-from-role
uses individual RoleConnected Issue/Story
Resolves #72
Resolves #73
CyberArk internal issue link: ONYX-14387
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
README
s) were updated in this PRBehavior
Security