Skip to content
Merged
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
1 change: 1 addition & 0 deletions tasks/set_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
command: systemctl is-system-running
register: __is_system_running
changed_when: false
check_mode: false
failed_when: false

- name: Require installed systemd
Expand Down
2 changes: 1 addition & 1 deletion tests/check_sssd_with_tlog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- name: Check if with tlog authselect feature enabled and nsswitch set correctly
assert:
that:
- __nsswitch_contents | regex_search('^passwd:\\s+sss', multiline=True)
- __nsswitch_contents | regex_search('^passwd:\\s+sss', multiline=True) | length > 0
- '"with-tlog" in __tlog_authselect_current.stdout'
when: '"with-tlog" in __tlog_authselect_features.stdout'
vars:
Expand Down
15 changes: 10 additions & 5 deletions tests/run_sssd_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
- name: Verify that contents of sssd conf are correct
assert:
that:
- __tlog_conf_content.stdout.find('scope={{ tlog_scope_sssd }}')
- ('scope=' + tlog_scope_sssd) in __tlog_conf_content.stdout
# yamllint disable-line rule:line-length
- __tlog_conf_content.stdout.find('users={{ tlog_users_sssd | join(', ') }}')
- ('users=' + tlog_users_sssd_str) in __tlog_conf_content.stdout
# yamllint disable-line rule:line-length
- __tlog_conf_content.stdout.find('groups={{ tlog_groups_sssd | join(', ') }}')
- ('groups=' + tlog_groups_sssd_str) in __tlog_conf_content.stdout
# yamllint disable-line rule:line-length
- __tlog_conf_content.stdout.find('exclude_users={{ tlog_exclude_users_sssd | join(', ') }}')
- ('exclude_users=' + tlog_exclude_users_sssd_str) in __tlog_conf_content.stdout
# yamllint disable-line rule:line-length
- __tlog_conf_content.stdout.find('exclude_groups={{ tlog_exclude_groups_sssd | join(', ') }}')
- ('exclude_groups=' + tlog_exclude_groups_sssd_str) in __tlog_conf_content.stdout
vars:
tlog_users_sssd_str: "{{ tlog_users_sssd | join(', ') }}"
tlog_groups_sssd_str: "{{ tlog_groups_sssd | join(', ') }}"
tlog_exclude_users_sssd_str: "{{ tlog_exclude_users_sssd | join(', ') }}"
tlog_exclude_groups_sssd_str: "{{ tlog_exclude_groups_sssd | join(', ') }}"
6 changes: 3 additions & 3 deletions tests/tasks/check_header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- name: Check for presence of ansible managed header, fingerprint
assert:
that:
- ansible_managed in content
- __ansible_managed in content
- __fingerprint in content
vars:
content: "{{ (__file_content | d(__content)).content | b64decode }}"
ansible_managed: "{{ lookup('template', 'get_ansible_managed.j2') }}"
content: "{{ __content.content | b64decode }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I copied this implementation from another role where I already have the file content, so I could skip the slurp - but here it isn't used

__ansible_managed: "{{ lookup('template', 'get_ansible_managed.j2') }}"
48 changes: 25 additions & 23 deletions tests/tests_sssd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,24 @@
- name: Run sssd tests
import_tasks: run_sssd_tests.yml

- name: Run role with tlog_scope_sssd all
import_role:
name: linux-system-roles.tlog
- name: Test role with tlog_scope_sssd all
vars:
tlog_scope_sssd: all
block:
- name: Run role
import_role:
name: linux-system-roles.tlog

- name: Check sssd authselect with tlog setup properly
import_tasks: check_sssd_with_tlog.yml
- name: Check sssd authselect with tlog setup properly
import_tasks: check_sssd_with_tlog.yml

- name: Run sssd tests
import_tasks: run_sssd_tests.yml
- name: Run sssd tests
import_tasks: run_sssd_tests.yml

- name: Check authselect files provider setup properly
import_tasks: check_sssd_files_provider.yml

- name: Run sssd tests
import_tasks: run_sssd_tests.yml
- name: Check authselect files provider setup properly
import_tasks: check_sssd_files_provider.yml

- name: Run role with tlog_scope_sssd some
import_role:
name: linux-system-roles.tlog
- name: Test role with tlog_scope_sssd some
vars:
tlog_scope_sssd: some
tlog_users_sssd:
Expand All @@ -50,24 +47,29 @@
tlog_groups_sssd:
- teachers
- students
block:
- name: Run role
import_role:
name: linux-system-roles.tlog

- name: Run sssd tests
import_tasks: run_sssd_tests.yml
- name: Run sssd tests
import_tasks: run_sssd_tests.yml

- name: Run role with excluded users and groups
include_role: # instead of import - so we can use public:
name: linux-system-roles.tlog
public: true
- name: Test role with excluded users and groups
vars:
tlog_scope_sssd: all
tlog_exclude_users_sssd:
- jeff
- james
tlog_exclude_groups_sssd:
- admins
block:
- name: Run role
import_role:
name: linux-system-roles.tlog

- name: Run sssd tests
import_tasks: run_sssd_tests.yml
- name: Run sssd tests
import_tasks: run_sssd_tests.yml

- name: Check for ansible_managed, fingerprint in generated files
include_tasks: tasks/check_header.yml
Expand Down
Loading