1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/iso_customize/tasks/iso_customize_exception.yml
patchback[bot] 5392e0f1cc
[PR #6403/eab39ffc backport][stable-5] iso_customize: fix integration test (#6426)
iso_customize: fix integration test (#6403)

* Fix bad parameters in integration test.

* Remove unrelated thing.

* Simply remove test.

(cherry picked from commit eab39ffc23)

Co-authored-by: Felix Fontein <felix@fontein.de>
2023-04-23 20:59:24 +02:00

71 lines
2.7 KiB
YAML

# Copyright (c) 2022, Ansible Project
# Copyright (c) 2022, VMware, Inc. All Rights Reserved.
# 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: "Testcase: local resource ISO does not exists"
community.general.iso_customize:
src_iso: "{{ test_dir }}/test11.iso"
dest_iso: "{{ test_dir }}/{{ dest_iso_name }}"
register: customized_result
failed_when: customized_result.msg.find('does not exist') == -1
- name: "Testcase:: dest dir does not exists"
community.general.iso_customize:
src_iso: "{{ test_dir }}/test1.iso"
dest_iso: "/aaa/{{ dest_iso_name }}"
register: customized_result
failed_when: customized_result.msg.find('does not exist') == -1
# Test: nothing is changed when no options "add files" and "delete files"
- block:
- name: "Testcase: no options 'add files' and 'delete files'"
community.general.iso_customize:
src_iso: "{{ test_dir }}/test1.iso"
dest_iso: "{{ test_dir }}/iso_customize_nochanged.iso"
- name: Get stats of a file test1.iso
ansible.builtin.stat:
path: "{{ test_dir }}/test1.iso"
register: iso_orginal
- name: Get stats of a file iso_customize_nochanged.iso
ansible.builtin.stat:
path: "{{ test_dir }}/iso_customize_nochanged.iso"
register: iso_customized
- name: compare size
fail: msg="Check we have nothing changed for customized ISO"
when: iso_orginal.stat.size != iso_customized.stat.size
- name: "Testcase: delete the non-existing file in ISO"
community.general.iso_customize:
src_iso: "{{ test_dir }}/test1.iso"
dest_iso: "{{ test_dir }}/{{ dest_iso_name }}"
delete_files:
- "/test03.cfg"
register: customized_result
failed_when: customized_result.msg.find("does not exist") == -1
# Test: failed when local src file does not exists
- name: "Testcase: local src file does not exists"
community.general.iso_customize:
src_iso: "{{ test_dir }}/test.iso"
dest_iso: "{{ test_dir }}/{{ dest_iso_name }}"
add_files:
- src_file: "{{ test_dir }}/test03.cfg"
dest_file: "/preseed/ubuntu.seed"
register: customized_result
failed_when: customized_result.msg.find("does not exist") == -1
# Test: filenames with whitespaces
# We report error: the user should be reponsible for the it
- name: "Testcase: filenames with whitespaces"
community.general.iso_customize:
src_iso: "{{ test_dir }}/test.iso"
dest_iso: "{{ test_dir }}/{{ dest_iso_name }}"
add_files:
- src_file: " {{ test_dir }}/test01.cfg "
dest_file: "/preseed/ubuntu.seed"
register: customized_result
failed_when: customized_result.msg.find("does not exist") == -1