---
- name: Verify the check command fails when source LV doesn't exist
  hosts: all
  vars:
    test_disk_min_size: "1g"
    test_disk_count: 10
    test_storage_pools:
      - name: test_vg1
        disks: "{{ range(0, 3) | map('extract', unused_disks) | list }}"
        volumes:
          - name: lv1
            size: "50%"
  tasks:
    - name: Run tests
      block:
        - name: Setup
          include_tasks: tasks/setup.yml

        - name: Test failure of check with verify set for incorrect LV
          include_tasks: verify-role-failed.yml
          vars:
            percent_space_required: 15
            __snapshot_failed_regex: >-
              source logical volume does not*
            __snapshot_failed_msg: >-
              Role check did not fail with incorrect LV name
            __snapshot_failed_params:
              snapshot_lvm_action: check
              snapshot_lvm_verify_only: true
              __snapshot_lvm_set:
                name: snapset1
                volumes:
                  - name: snapshot VG1 LV1
                    vg: test_vg1
                    lv: xxxxx
                    percent_space_required: 20
            __snapshot_failed_changed: false
      always:
        - name: Cleanup
          include_tasks: tasks/cleanup.yml
          tags: tests::cleanup
