mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add APB role_type to ansible-galaxy init (#36789)
* Add APB role_type to ansible-galaxy init * Add handlers scaffolding * Fix shippable errors by setting default * Add unit tests and fix shippable * Updates init description
This commit is contained in:
parent
a10df8b0b5
commit
90943a3362
33 changed files with 234 additions and 6 deletions
|
@ -368,11 +368,41 @@ class TestGalaxyInitDefault(unittest.TestCase, ValidRoleTests):
|
|||
self.assertEqual(metadata.get('galaxy_info', dict()).get('author'), 'your name', msg='author was not set properly in metadata')
|
||||
|
||||
|
||||
class TestGalaxyInitContainerEnabled(unittest.TestCase, ValidRoleTests):
|
||||
class TestGalaxyInitAPB(unittest.TestCase, ValidRoleTests):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.setUpRole('delete_me_container', galaxy_args=['--container-enabled'])
|
||||
cls.setUpRole('delete_me_apb', galaxy_args=['--type=apb'])
|
||||
|
||||
def test_metadata_apb_tag(self):
|
||||
with open(os.path.join(self.role_dir, 'meta', 'main.yml'), 'r') as mf:
|
||||
metadata = yaml.safe_load(mf)
|
||||
self.assertIn('apb', metadata.get('galaxy_info', dict()).get('galaxy_tags', []), msg='apb tag not set in role metadata')
|
||||
|
||||
def test_metadata_contents(self):
|
||||
with open(os.path.join(self.role_dir, 'meta', 'main.yml'), 'r') as mf:
|
||||
metadata = yaml.safe_load(mf)
|
||||
self.assertEqual(metadata.get('galaxy_info', dict()).get('author'), 'your name', msg='author was not set properly in metadata')
|
||||
|
||||
def test_apb_yml(self):
|
||||
self.assertTrue(os.path.exists(os.path.join(self.role_dir, 'apb.yml')), msg='apb.yml was not created')
|
||||
|
||||
def test_test_yml(self):
|
||||
with open(os.path.join(self.role_dir, 'tests', 'test.yml'), 'r') as f:
|
||||
test_playbook = yaml.safe_load(f)
|
||||
print(test_playbook)
|
||||
self.assertEqual(len(test_playbook), 1)
|
||||
self.assertEqual(test_playbook[0]['hosts'], 'localhost')
|
||||
self.assertFalse(test_playbook[0]['gather_facts'])
|
||||
self.assertEqual(test_playbook[0]['connection'], 'local')
|
||||
self.assertIsNone(test_playbook[0]['tasks'], msg='We\'re expecting an unset list of tasks in test.yml')
|
||||
|
||||
|
||||
class TestGalaxyInitContainer(unittest.TestCase, ValidRoleTests):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.setUpRole('delete_me_container', galaxy_args=['--type=container'])
|
||||
|
||||
def test_metadata_container_tag(self):
|
||||
with open(os.path.join(self.role_dir, 'meta', 'main.yml'), 'r') as mf:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue