Skip to content

Commit 47a373a

Browse files
committed
simplify tests
1 parent 98b921c commit 47a373a

File tree

8 files changed

+34
-116
lines changed

8 files changed

+34
-116
lines changed

.travis.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,19 @@ python: "2.7"
66
install:
77
- pip install ansible
88

9+
# Add ansible.cfg to pick up roles path.
10+
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
11+
912
script:
10-
- ansible-playbook --connection=local --limit=localhost --inventory-file=tests/hosts tests/all.yml
13+
# Syntax Check
14+
- ansible-playbook -i localhost, tests/test.yml --syntax-check
15+
16+
# Run test.yml
17+
- ansible-playbook -i localhost, --connection=local tests/test.yml
18+
19+
# Run the role/playbook again, checking to make sure it's idempotent.
20+
- >
21+
ansible-playbook -i localhost, --connection=local tests/test.yml
22+
| grep -q 'changed=0.*failed=0'
23+
&& (echo 'Idempotence test: pass' && exit 0)
24+
|| (echo 'Idempotence test: fail' && exit 1)

tests/add_user.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/all.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/cleanup.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/hosts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
[test_runners]
21
localhost
3-

tests/roles/users

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/ssh_keys_optional.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

tests/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
3+
- hosts: localhost
4+
remote_user: root
5+
vars:
6+
users:
7+
- name: Ansible Test User
8+
username: ansibletestuser
9+
uid: 2222
10+
groups: [users, bin]
11+
shell: /bin/sh
12+
profile: |
13+
alias ll='ls -lah'
14+
alias cp='cp -iv'
15+
ssh_key:
16+
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVpUJQCOaPg3p5xro9e+1fkGRWNOGrrExiKMqTE91Fwu349bxfMnMzRS0PAERouR9EEL+Ee4Yzhav/uNc35eCtXzACtluXnAncMrQj6pM3IqASynhvXTygHljmcMbBSDQtLrTZeW+YzIcOgk5UM1yBi26WoUYva2aCr9IRvKdYreAK08OiMdZedpOye0ZdvIYJGcyITwc6YMmrAhP7jZlrk/mDEkf2a4eBp+475o7MJtaC9npqYkToM8vqvx5AGEKqXt7/f1/paOY7KsR+VGPQy6k2RkXjWBsXPesZ3d3XLZHE60wAk0EsuJO8A25+uWSB6ILQeRSYYmGea/WIf6kd [email protected]"
17+
18+
roles:
19+
- users

0 commit comments

Comments
 (0)