Skip to content

Commit

Permalink
Add test with device name starting with 'crypt'. (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Nov 21, 2024
1 parent 0f7c5f0 commit 32047dc
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/integration/targets/luks_device/tasks/tests/cryptname.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

- name: Fix name
set_fact:
cryptname: "crypt{{ '%0x' % ((2**32) | random) }}"

- name: Create
luks_device:
device: "{{ cryptfile_device }}"
name: "{{ cryptname }}"
state: present
keyfile: "{{ remote_tmp_dir }}/keyfile1"
pbkdf:
iteration_time: 0.1
become: true
register: create
- name: Open
luks_device:
device: "{{ cryptfile_device }}"
name: "{{ cryptname }}"
state: opened
keyfile: "{{ remote_tmp_dir }}/keyfile1"
become: true
register: open
- name: Open (idempotent)
luks_device:
device: "{{ cryptfile_device }}"
name: "{{ cryptname }}"
state: opened
keyfile: "{{ remote_tmp_dir }}/keyfile1"
become: true
register: open_idem
- name: Closed (via name)
luks_device:
name: "{{ cryptname }}"
state: closed
become: true
register: close
- name: Closed (via name, idempotent)
luks_device:
name: "{{ cryptname }}"
state: closed
become: true
register: close_idem
- name: Absent
luks_device:
device: "{{ cryptfile_device }}"
name: "{{ cryptname }}"
state: absent
become: true
register: absent
- assert:
that:
- create is changed
- open is changed
- open_idem is not changed
- close is changed
- close_idem is not changed
- absent is changed

0 comments on commit 32047dc

Please sign in to comment.