Fix the CI gate failure

The root cause is getting a error ip address
for Zaqar service.

Change-Id: I879a4e0115e583b9752301a9d8167f77a70ca187
This commit is contained in:
hwang 2024-08-29 13:39:10 -07:00
parent b4a6ebe274
commit c0522e2419

View File

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import subprocess
from unittest import mock from unittest import mock
from oslo_utils import netutils from oslo_utils import netutils
@ -21,14 +22,18 @@ from zaqarclient.queues import client
from zaqarclient.tests import base from zaqarclient.tests import base
from zaqarclient.tests.transport import dummy from zaqarclient.tests.transport import dummy
cmd = 'cat /etc/zaqar/uwsgi.conf | grep http'
MY_IP = netutils.get_my_ipv4() MY_HOST_IP = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if len(MY_HOST_IP.stdout.split("= ")) < 2:
MY_IP = netutils.get_my_ipv4() + ':8888'
else:
MY_IP = MY_HOST_IP.stdout.split("= ")[1]
class QueuesTestBase(base.TestBase): class QueuesTestBase(base.TestBase):
transport_cls = dummy.DummyTransport transport_cls = dummy.DummyTransport
url = 'http://%s:8888' % MY_IP url = 'http://%s' % MY_IP
version = 1 version = 1
def setUp(self): def setUp(self):