mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Tidied up a little, added tests
Moved repo_url_to_role_name to common method in ansible.utils Added unit test for repo_url_to_role_name Added integration tests for galaxy
This commit is contained in:
parent
b550cb9bc3
commit
c2fe33f9f4
7 changed files with 38 additions and 7 deletions
|
@ -14,9 +14,12 @@ else
|
|||
CREDENTIALS_ARG =
|
||||
endif
|
||||
|
||||
# http://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
|
||||
TMPDIR = $(shell mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
|
||||
|
||||
VAULT_PASSWORD_FILE = vault-password
|
||||
|
||||
all: non_destructive destructive includes unicode test_var_precedence check_mode test_hash test_handlers test_group_by test_vault parsing
|
||||
all: non_destructive destructive includes unicode test_var_precedence check_mode test_hash test_handlers test_group_by test_vault parsing test_galaxy
|
||||
|
||||
parsing:
|
||||
ansible-playbook bad_parsing.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -vvv $(TEST_FLAGS) --tags common,scenario1; [ $$? -eq 3 ]
|
||||
|
@ -101,3 +104,12 @@ rackspace: $(CREDENTIALS_FILE)
|
|||
RC=$$? ; \
|
||||
CLOUD_RESOURCE_PREFIX="$(CLOUD_RESOURCE_PREFIX)" make rackspace_cleanup ; \
|
||||
exit $$RC;
|
||||
|
||||
test_galaxy:
|
||||
mytmpdir=$(TMPDIR) ; \
|
||||
ansible-galaxy install -r galaxy_rolesfile -p $$mytmpdir/roles ; \
|
||||
cp galaxy_playbook.yml $$mytmpdir ; \
|
||||
ansible-playbook -i $(INVENTORY) $$mytmpdir/galaxy_playbook.yml -v $(TEST_FLAGS) ; \
|
||||
RC=$$? ; \
|
||||
rm -rf $$mytmpdir ; \
|
||||
exit $$RC
|
||||
|
|
5
test/integration/galaxy_playbook.yml
Normal file
5
test/integration/galaxy_playbook.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- hosts: localhost
|
||||
connection: local
|
||||
|
||||
roles:
|
||||
- "git-ansible-galaxy"
|
2
test/integration/galaxy_rolesfile
Normal file
2
test/integration/galaxy_rolesfile
Normal file
|
@ -0,0 +1,2 @@
|
|||
git+http://bitbucket.org/willthames/git-ansible-galaxy,v1.2
|
||||
hg+ssh://hg@bitbucket.org/willthames/hg-ansible-galaxy
|
|
@ -778,3 +778,8 @@ class TestUtils(unittest.TestCase):
|
|||
assert 'msg' not in data
|
||||
assert data['censored'] == 'results hidden due to no_log parameter'
|
||||
|
||||
def test_repo_url_to_role_name(self):
|
||||
tests = [("http://git.example.com/repos/repo.git", "repo"),
|
||||
("ssh://git@git.example.com:repos/role-name", "role-name")]
|
||||
for (url, result) in tests:
|
||||
self.assertEqual(ansible.utils.repo_url_to_role_name(url), result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue