From 8a754e0858d922e955e71b253c139e071ecec432 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 18:04:21 +0200 Subject: Adding upstream version 2.14.3. Signed-off-by: Daniel Baumann --- test/integration/targets/apt_key/aliases | 5 +++ test/integration/targets/apt_key/meta/main.yml | 2 + test/integration/targets/apt_key/tasks/apt_key.yml | 25 +++++++++++ .../targets/apt_key/tasks/apt_key_binary.yml | 12 +++++ .../targets/apt_key/tasks/apt_key_inline_data.yml | 5 +++ test/integration/targets/apt_key/tasks/file.yml | 52 ++++++++++++++++++++++ test/integration/targets/apt_key/tasks/main.yml | 29 ++++++++++++ 7 files changed, 130 insertions(+) create mode 100644 test/integration/targets/apt_key/aliases create mode 100644 test/integration/targets/apt_key/meta/main.yml create mode 100644 test/integration/targets/apt_key/tasks/apt_key.yml create mode 100644 test/integration/targets/apt_key/tasks/apt_key_binary.yml create mode 100644 test/integration/targets/apt_key/tasks/apt_key_inline_data.yml create mode 100644 test/integration/targets/apt_key/tasks/file.yml create mode 100644 test/integration/targets/apt_key/tasks/main.yml (limited to 'test/integration/targets/apt_key') diff --git a/test/integration/targets/apt_key/aliases b/test/integration/targets/apt_key/aliases new file mode 100644 index 0000000..a820ec9 --- /dev/null +++ b/test/integration/targets/apt_key/aliases @@ -0,0 +1,5 @@ +shippable/posix/group1 +skip/freebsd +skip/osx +skip/macos +skip/rhel diff --git a/test/integration/targets/apt_key/meta/main.yml b/test/integration/targets/apt_key/meta/main.yml new file mode 100644 index 0000000..07faa21 --- /dev/null +++ b/test/integration/targets/apt_key/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_tests diff --git a/test/integration/targets/apt_key/tasks/apt_key.yml b/test/integration/targets/apt_key/tasks/apt_key.yml new file mode 100644 index 0000000..0e01723 --- /dev/null +++ b/test/integration/targets/apt_key/tasks/apt_key.yml @@ -0,0 +1,25 @@ +- name: Ensure key is not there to start with. + apt_key: + id: 36A1D7869245C8950F966E92D8576A8BA88D21E9 + state: absent + +- name: run first docs example + apt_key: + keyserver: keyserver.ubuntu.com + id: 36A1D7869245C8950F966E92D8576A8BA88D21E9 + register: apt_key_test0 + +- debug: var=apt_key_test0 + +- name: re-run first docs example + apt_key: + keyserver: keyserver.ubuntu.com + id: 36A1D7869245C8950F966E92D8576A8BA88D21E9 + register: apt_key_test1 + +- name: validate results + assert: + that: + - 'apt_key_test0.changed is defined' + - 'apt_key_test0.changed' + - 'not apt_key_test1.changed' diff --git a/test/integration/targets/apt_key/tasks/apt_key_binary.yml b/test/integration/targets/apt_key/tasks/apt_key_binary.yml new file mode 100644 index 0000000..b120bd5 --- /dev/null +++ b/test/integration/targets/apt_key/tasks/apt_key_binary.yml @@ -0,0 +1,12 @@ +--- + +- name: Ensure import of binary key downloaded using URLs works + apt_key: + url: https://ci-files.testing.ansible.com/test/integration/targets/apt_key/apt-key-example-binary.gpg + register: apt_key_binary_test + +- name: Validate the results + assert: + that: + - 'apt_key_binary_test.changed is defined' + - 'apt_key_binary_test.changed' diff --git a/test/integration/targets/apt_key/tasks/apt_key_inline_data.yml b/test/integration/targets/apt_key/tasks/apt_key_inline_data.yml new file mode 100644 index 0000000..916fa5a --- /dev/null +++ b/test/integration/targets/apt_key/tasks/apt_key_inline_data.yml @@ -0,0 +1,5 @@ +- name: "Ensure import of a deliberately corrupted downloaded GnuPG binary key results in an 'inline data' occurence in the message" + apt_key: + url: https://ci-files.testing.ansible.com/test/integration/targets/apt_key/apt-key-corrupt-zeros-2k.gpg + register: gpg_inline_result + failed_when: "not ('inline data' in gpg_inline_result.msg)" diff --git a/test/integration/targets/apt_key/tasks/file.yml b/test/integration/targets/apt_key/tasks/file.yml new file mode 100644 index 0000000..c22f3a4 --- /dev/null +++ b/test/integration/targets/apt_key/tasks/file.yml @@ -0,0 +1,52 @@ +- name: Get Fedora GPG Key + get_url: + url: https://ci-files.testing.ansible.com/test/integration/targets/apt_key/fedora.gpg + dest: /tmp/fedora.gpg + +- name: Ensure clean slate + apt_key: + id: 1161AE6945719A39 + state: absent + +- name: Run apt_key with both file and keyserver + apt_key: + file: /tmp/fedora.gpg + keyserver: keys.gnupg.net + id: 97A1AE57C3A2372CCA3A4ABA6C13026D12C944D0 + register: both_file_keyserver + ignore_errors: true + +- name: Run apt_key with file only + apt_key: + file: /tmp/fedora.gpg + register: only_file + +- name: Run apt_key with keyserver only + apt_key: + keyserver: keys.gnupg.net + id: 97A1AE57C3A2372CCA3A4ABA6C13026D12C944D0 + register: only_keyserver + +- name: validate results + assert: + that: + - 'both_file_keyserver is failed' + - 'only_file.changed' + - 'not only_keyserver.changed' + +- name: remove fedora.gpg + apt_key: + id: 1161AE6945719A39 + state: absent + register: remove_fedora + +- name: add key from url + apt_key: + url: https://ci-files.testing.ansible.com/test/integration/targets/apt_key/fedora.gpg + register: apt_key_url + +- name: verify key from url + assert: + that: + - remove_fedora is changed + - apt_key_url is changed diff --git a/test/integration/targets/apt_key/tasks/main.yml b/test/integration/targets/apt_key/tasks/main.yml new file mode 100644 index 0000000..ffb89b2 --- /dev/null +++ b/test/integration/targets/apt_key/tasks/main.yml @@ -0,0 +1,29 @@ +# Test code for the apt_key module. +# (c) 2017, James Tanner + +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +- import_tasks: 'apt_key.yml' + when: ansible_distribution in ('Ubuntu', 'Debian') + +- import_tasks: 'apt_key_inline_data.yml' + when: ansible_distribution in ('Ubuntu', 'Debian') + +- import_tasks: 'file.yml' + when: ansible_distribution in ('Ubuntu', 'Debian') + +- import_tasks: 'apt_key_binary.yml' + when: ansible_distribution in ('Ubuntu', 'Debian') -- cgit v1.2.3