From 9b0c9838603a0858a7cf3e3362a9c6c2f83566d3 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 20 May 2024 09:31:23 +0200 Subject: [PATCH] Move 'docker' homebrew tests into homebrew tests (#8395) Move 'docker' homebrew tests into homebrew tests. --- .../integration/targets/docker/tasks/main.yml | 39 ------------------- .../{docker => homebrew}/handlers/main.yml | 0 .../targets/homebrew/tasks/casks.yml | 2 - .../targets/homebrew/tasks/docker.yml | 37 ++++++++++++++++++ .../targets/homebrew/tasks/formulae.yml | 2 - .../targets/homebrew/tasks/main.yml | 5 +-- 6 files changed, 39 insertions(+), 46 deletions(-) delete mode 100644 tests/integration/targets/docker/tasks/main.yml rename tests/integration/targets/{docker => homebrew}/handlers/main.yml (100%) create mode 100644 tests/integration/targets/homebrew/tasks/docker.yml diff --git a/tests/integration/targets/docker/tasks/main.yml b/tests/integration/targets/docker/tasks/main.yml deleted file mode 100644 index fd636247f4..0000000000 --- a/tests/integration/targets/docker/tasks/main.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -# 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 - -- when: ansible_facts.distribution == 'MacOSX' - block: - - name: MACOS | Find brew binary - command: which brew - register: brew_which - - - name: MACOS | Get owner of brew binary - stat: - path: "{{ brew_which.stdout }}" - register: brew_stat - - - name: MACOS | Install docker without --formula - community.general.homebrew: - name: docker - state: present - become: true - become_user: "{{ brew_stat.stat.pw_name }}" - ignore_errors: true - register: result - - - name: Check that installing docker without --formula raises warning - assert: - that: - - result is failed - - - name: MACOS | Install docker - community.general.homebrew: - name: docker - state: present - force_formula: true - become: true - become_user: "{{ brew_stat.stat.pw_name }}" - notify: - - uninstall docker diff --git a/tests/integration/targets/docker/handlers/main.yml b/tests/integration/targets/homebrew/handlers/main.yml similarity index 100% rename from tests/integration/targets/docker/handlers/main.yml rename to tests/integration/targets/homebrew/handlers/main.yml diff --git a/tests/integration/targets/homebrew/tasks/casks.yml b/tests/integration/targets/homebrew/tasks/casks.yml index 42d3515bf2..ffbe67d158 100644 --- a/tests/integration/targets/homebrew/tasks/casks.yml +++ b/tests/integration/targets/homebrew/tasks/casks.yml @@ -12,13 +12,11 @@ - name: Find brew binary command: which brew register: brew_which - when: ansible_distribution in ['MacOSX'] - name: Get owner of brew binary stat: path: "{{ brew_which.stdout }}" register: brew_stat - when: ansible_distribution in ['MacOSX'] #- name: Use ignored-pinned option while upgrading all # homebrew: diff --git a/tests/integration/targets/homebrew/tasks/docker.yml b/tests/integration/targets/homebrew/tasks/docker.yml new file mode 100644 index 0000000000..3b9e2ea6b4 --- /dev/null +++ b/tests/integration/targets/homebrew/tasks/docker.yml @@ -0,0 +1,37 @@ +--- +# 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: MACOS | Find brew binary + command: which brew + register: brew_which + +- name: MACOS | Get owner of brew binary + stat: + path: "{{ brew_which.stdout }}" + register: brew_stat + +- name: MACOS | Install docker without --formula + community.general.homebrew: + name: docker + state: present + become: true + become_user: "{{ brew_stat.stat.pw_name }}" + ignore_errors: true + register: result + +- name: Check that installing docker without --formula raises warning + assert: + that: + - result is failed + +- name: MACOS | Install docker + community.general.homebrew: + name: docker + state: present + force_formula: true + become: true + become_user: "{{ brew_stat.stat.pw_name }}" + notify: + - uninstall docker diff --git a/tests/integration/targets/homebrew/tasks/formulae.yml b/tests/integration/targets/homebrew/tasks/formulae.yml index 1db3ef1a6a..1ca8d753e7 100644 --- a/tests/integration/targets/homebrew/tasks/formulae.yml +++ b/tests/integration/targets/homebrew/tasks/formulae.yml @@ -12,13 +12,11 @@ - name: Find brew binary command: which brew register: brew_which - when: ansible_distribution in ['MacOSX'] - name: Get owner of brew binary stat: path: "{{ brew_which.stdout }}" register: brew_stat - when: ansible_distribution in ['MacOSX'] #- name: Use ignored-pinned option while upgrading all # homebrew: diff --git a/tests/integration/targets/homebrew/tasks/main.yml b/tests/integration/targets/homebrew/tasks/main.yml index f5479917ea..00d0bcf31c 100644 --- a/tests/integration/targets/homebrew/tasks/main.yml +++ b/tests/integration/targets/homebrew/tasks/main.yml @@ -9,9 +9,8 @@ # 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 -- block: - - include_tasks: 'formulae.yml' - - when: ansible_distribution in ['MacOSX'] block: + - include_tasks: 'formulae.yml' - include_tasks: 'casks.yml' + - include_tasks: 'docker.yml'