From 666db05eda90f594864d12508ae6930d8962a9b2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 05:39:21 +0100 Subject: [PATCH] [PR #9170/bf6ae7bf backport][stable-10] pipx: add testcase for upgrade --global (#9637) pipx: add testcase for upgrade --global (#9170) (cherry picked from commit bf6ae7bf59564d8d210848b1e1e88c122453c5df) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- tests/integration/targets/pipx/tasks/main.yml | 3 ++ .../pipx/tasks/testcase-8793-global.yml | 2 +- .../tasks/testcase-9103-upgrade-global.yml | 38 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/integration/targets/pipx/tasks/testcase-9103-upgrade-global.yml diff --git a/tests/integration/targets/pipx/tasks/main.yml b/tests/integration/targets/pipx/tasks/main.yml index 314e9dfa52d..0e048263711 100644 --- a/tests/integration/targets/pipx/tasks/main.yml +++ b/tests/integration/targets/pipx/tasks/main.yml @@ -264,3 +264,6 @@ - name: Include testcase for PR 9009 injectpkg --global ansible.builtin.include_tasks: testcase-9009-fixglobal.yml + + - name: Include testcase for PR 9103 upgrade --global + ansible.builtin.include_tasks: testcase-9103-upgrade-global.yml diff --git a/tests/integration/targets/pipx/tasks/testcase-8793-global.yml b/tests/integration/targets/pipx/tasks/testcase-8793-global.yml index 7d3c8713065..b9bf8b75f6c 100644 --- a/tests/integration/targets/pipx/tasks/testcase-8793-global.yml +++ b/tests/integration/targets/pipx/tasks/testcase-8793-global.yml @@ -5,7 +5,7 @@ - name: Set up environment environment: - PATH: /usr/local/bin:{{ ansible_env.PATH }} + PATH: /root/.local/bin:/usr/local/bin:{{ ansible_env.PATH }} block: - name: Remove global pipx dir ansible.builtin.file: diff --git a/tests/integration/targets/pipx/tasks/testcase-9103-upgrade-global.yml b/tests/integration/targets/pipx/tasks/testcase-9103-upgrade-global.yml new file mode 100644 index 00000000000..60621a42be5 --- /dev/null +++ b/tests/integration/targets/pipx/tasks/testcase-9103-upgrade-global.yml @@ -0,0 +1,38 @@ +--- +# 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: 9103-Ensure application hello-world is uninstalled + community.general.pipx: + name: hello-world + state: absent + global: true + +- name: 9103-Install application hello-world + community.general.pipx: + name: hello-world + source: hello-world==0.1 + global: true + register: install_hw + +- name: 9103-Upgrade application hello-world + community.general.pipx: + state: upgrade + name: hello-world + global: true + register: upgrade_hw + +- name: 9103-Ensure application pylint is uninstalled + community.general.pipx: + name: pylint + state: absent + global: true + +- name: 9103-Assertions + ansible.builtin.assert: + that: + - install_hw is changed + - upgrade_hw is changed + - upgrade_hw.cmd[-3] == "upgrade" + - upgrade_hw.cmd[-2] == "--global"