From c906ab2a91f98098386246c21bb72149a32c073c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= <radoslaw.piliszek@gmail.com>
Date: Sat, 28 May 2022 14:11:57 +0200
Subject: [PATCH] [CI] Use the script module for running core tests

Depending on the way the testing script is called, it may sense
stdin being available and not being a tty [1]. The logic in the
Glance part of the client is then broken [2] as it detects both
volume and stdin as sources of the image and fails.
The proposed approach uses the script module for these tests.
This fixes the cephadm upgrade jobs where this script was called
using the shell module which causes this behaviour. The script
module is not affected. FWIW, the command module is affected
the same as shell because shell extends the command module.

[1] https://opendev.org/openstack/python-openstackclient/src/commit/6810414e45a32dd44263dff47fec161989508ef0/openstackclient/image/v2/image.py#L114-L120
[2] https://opendev.org/openstack/python-openstackclient/src/commit/6810414e45a32dd44263dff47fec161989508ef0/openstackclient/image/v2/image.py#L414

Change-Id: I3ce4059063e3a51eb1c5b42bda79893b56bd85f0
Story: 2006294
---
 tests/run.yml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/run.yml b/tests/run.yml
index afe019d1be..7fd36e6b13 100644
--- a/tests/run.yml
+++ b/tests/run.yml
@@ -678,9 +678,15 @@
             TLS_ENABLED: "{{ tls_enabled }}"
           when: dashboard_enabled
 
+        # NOTE(yoctozepto): We need the script module here to avoid
+        # a bug in Glance OSC [1][2] which results in a failure when a volume
+        # is given as a source. The stdin works differently in shell/command
+        # than script.
+        # [1] https://opendev.org/openstack/python-openstackclient/src/commit/6810414e45a32dd44263dff47fec161989508ef0/openstackclient/image/v2/image.py#L114-L120
+        # [2] https://opendev.org/openstack/python-openstackclient/src/commit/6810414e45a32dd44263dff47fec161989508ef0/openstackclient/image/v2/image.py#L414
         - name: Run test-core-openstack.sh script
-          shell:
-            cmd: tests/test-core-openstack.sh
+          script:
+            cmd: test-core-openstack.sh
             executable: /bin/bash
             chdir: "{{ kolla_ansible_src_dir }}"
           environment:
-- 
GitLab