Skip to content

Commit

Permalink
Remove last instance of ignore_errors: yes
Browse files Browse the repository at this point in the history
and check for errors properly. Verify again that data have not been lost.

Do not use a pool type of partition, seems to be unimplemented.

Create one volume in the pool, the role does not cope with empty pools.

Note that even with those changes the role application fails -
apparently it refuses to create a VG when there is already a filesystem,
even with safe mode off.
  • Loading branch information
pcahyna committed Oct 15, 2019
1 parent 2fd8c33 commit d2f3d97
Showing 1 changed file with 49 additions and 26 deletions.
75 changes: 49 additions & 26 deletions tests/tests_disk_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,36 +124,59 @@
disks: "{{ unused_disks }}"
type: partition

- name: Verify the output
assert:
that: "{{ blivet_output.failed and
blivet_output.msg|regex_search('cannot remove existing formatting and/or devices on disk.*in safe mode') and
not blivet_output.changed }}"
msg: "Unexpected behavior w/ existing data on specified disks"
- name: UNREACH
fail:
msg: "this should be unreachable"

- name: Create a partition pool on the disk already containing a file system w/o safe_mode
include_role:
name: storage
rescue:
- name: Check that we failed in the role
assert:
that:
- ansible_failed_task.name != 'UNREACH'
msg: "Role has not failed when it should have"
vars:
storage_safe_mode: false
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: partition
# Ugh! needed to expand ansible_failed_task
storage_provider: blivet

- name: Verify the output
assert:
that: "{{ not blivet_output.failed }}"
msg: "failed to create partition pool over existing file system using default value of safe_mode"
that: "blivet_output.failed and
blivet_output.msg|regex_search('cannot remove existing formatting and/or devices on disk.*in safe mode') and
not blivet_output.changed"
msg: "Unexpected behavior w/ existing data on specified disks"

- name: Clean up
include_role:
name: storage
vars:
storage_volumes:
- name: test1
type: disk
disks: "{{ unused_disks }}"
present: false
- name: stat the file
stat:
path: "{{ testfile }}"
register: stat_r

- name: assert file presence
assert:
that:
stat_r.stat.isreg is defined and stat_r.stat.isreg
msg: "data lost!"

- name: Create a LVM pool on the disk already containing a file system w/o safe_mode
include_role:
name: storage
vars:
storage_safe_mode: false
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: partition

ignore_errors: yes
- name: Verify the output
assert:
that: not blivet_output.failed
msg: "failed to create LVM pool over existing file system using default value of safe_mode"

- name: Clean up
include_role:
name: storage
vars:
storage_volumes:
- name: test1
type: disk
disks: "{{ unused_disks }}"
present: false

0 comments on commit d2f3d97

Please sign in to comment.