Skip to content
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

Fix the Sanity Test for Ansible 2.16 version #205

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# - stable-2.13 (3.8, 3.9, 3.10)
# - stable-2.14 (3.9, 3.10, 3.11)
# - stable-2.15 (3.9, 3.10, 3.11)
# - devel (3.10)
# - stable-2.16 (3.10, 3.11, 3.12)
# - devel (3.11)
#
# As Ansible's devel version is unstable, it should be considered a smoke signal
# for the next released version. Failures against the devel version should not
Expand Down Expand Up @@ -47,8 +48,14 @@ jobs:
python: '3.11'
- ansible: stable-2.15
python: '3.11'
- ansible: devel
- ansible: stable-2.16
python: '3.10'
- ansible: stable-2.16
python: '3.11'
- ansible: stable-2.16
python: '3.12'
- ansible: devel
python: '3.11'

runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -104,8 +111,14 @@ jobs:
python: '3.11'
- ansible: stable-2.15
python: '3.11'
- ansible: devel
- ansible: stable-2.16
python: '3.10'
- ansible: stable-2.16
python: '3.11'
- ansible: stable-2.16
python: '3.12'
- ansible: devel
python: '3.11'
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand Down
4 changes: 4 additions & 0 deletions tests/sanity/ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Jenkinsfile shebang
plugins/lookup/conjur_variable.py validate-modules:version-added-must-be-major-or-minor
dev/policy/root.yml yamllint:unparsable-with-libyaml # File loaded by Conjur server, not via Python
secrets.yml yamllint:unparsable-with-libyaml # File loaded by Summon, not via Python
12 changes: 6 additions & 6 deletions tests/unit/plugins/lookup/test_conjur_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def test_merge_dictionaries(self):
{},
{'id': 'host/ansible/ansible-fake', 'api_key': 'fakekey'}
)
self.assertEquals(MockMergeDictionaries.RESPONSE, functionOutput)
self.assertEqual(MockMergeDictionaries.RESPONSE, functionOutput)

def test_load_identity_from_file(self):
load_identity = _load_identity_from_file("/etc/conjur.identity", "https://conjur-fake")
self.assertEquals(MockFileload.RESPONSE, load_identity)
self.assertEqual(MockFileload.RESPONSE, load_identity)

def test_load_conf_from_file(self):
load_conf = _load_conf_from_file("/etc/conjur.conf")
self.assertEquals(MockFileload.RESPONSE, load_conf)
self.assertEqual(MockFileload.RESPONSE, load_conf)

@patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable.open_url')
def test_fetch_conjur_token(self, mock_open_url):
Expand All @@ -49,7 +49,7 @@ def test_fetch_conjur_token(self, mock_open_url):
method="POST",
validate_certs=True,
ca_path="cert_file")
self.assertEquals("response body", result)
self.assertEqual("response body", result)

@patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._repeat_open_url')
def test_fetch_conjur_variable(self, mock_repeat_open_url):
Expand All @@ -63,7 +63,7 @@ def test_fetch_conjur_variable(self, mock_repeat_open_url):
method="GET",
validate_certs=True,
ca_path="cert_file")
self.assertEquals(['response body'], result)
self.assertEqual(['response body'], result)

@patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_variable')
@patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_token')
Expand All @@ -80,7 +80,7 @@ def test_run(self, mock_merge_dictionaries, mock_fetch_conjur_token, mock_fetch_
kwargs = {'as_file': False, 'conf_file': 'conf_file', 'validate_certs': False}
result = self.lookup.run(terms, **kwargs)

self.assertEquals(result, ["conjur_variable"])
self.assertEqual(result, ["conjur_variable"])

@patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_variable')
@patch('ansible_collections.cyberark.conjur.plugins.lookup.conjur_variable._fetch_conjur_token')
Expand Down
Loading