Hitachi: Stop frequently REST API request in test
This patch stops submitting frequently REST API request in test scripts, to avoid a risk of failing the scripts by unexpected REST API response from a psuedo REST API in the scripts. Hitachi driver submits a REST API request frequently, to avoid REST API session timeout. it should be stopped while running test scripts, or the request bothers REST APIs which is for cinder features, like creating volume and delete snapshots. The test scripts have codes to stop submitting, but one of the code does not work by using incorrect variable. The patch fix the variable name to stop that correctoly. Closes-Bug: #2063317 Change-Id: I81090aee4ed6c288f7d9bbdb45d7cc849663e393
This commit is contained in:
parent
e28867ba8d
commit
60b7062902
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2022, 2023, Hitachi, Ltd.
|
# Copyright (C) 2022, 2024, Hitachi, Ltd.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -786,10 +786,8 @@ class HBSDMIRRORFCDriverTest(test.TestCase):
|
|||||||
self.configuration.hitachi_mirror_pair_target_number),
|
self.configuration.hitachi_mirror_pair_target_number),
|
||||||
drv.common.rep_secondary._PAIR_TARGET_NAME)
|
drv.common.rep_secondary._PAIR_TARGET_NAME)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.rep_primary.client.keep_session_loop.stop()
|
drv.common.rep_primary.client.keep_session_loop.stop()
|
||||||
self.driver.common.rep_primary.client.keep_session_loop.wait()
|
drv.common.rep_secondary.client.keep_session_loop.stop()
|
||||||
self.driver.common.rep_secondary.client.keep_session_loop.stop()
|
|
||||||
self.driver.common.rep_secondary.client.keep_session_loop.wait()
|
|
||||||
self._setup_config()
|
self._setup_config()
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2020, 2023, Hitachi, Ltd.
|
# Copyright (C) 2020, 2024, Hitachi, Ltd.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -646,8 +646,7 @@ class HBSDRESTFCDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(4, request.call_count)
|
self.assertEqual(4, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
@ -674,8 +673,7 @@ class HBSDRESTFCDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(9, request.call_count)
|
self.assertEqual(9, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
@ -703,8 +701,7 @@ class HBSDRESTFCDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(9, request.call_count)
|
self.assertEqual(9, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
@ -756,8 +753,7 @@ class HBSDRESTFCDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(10, request.call_count)
|
self.assertEqual(10, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
@ -783,8 +779,7 @@ class HBSDRESTFCDriverTest(test.TestCase):
|
|||||||
self.assertEqual(5, request.call_count)
|
self.assertEqual(5, request.call_count)
|
||||||
self.configuration.hitachi_pools = tmp_pools
|
self.configuration.hitachi_pools = tmp_pools
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
def test_create_volume(self, request):
|
def test_create_volume(self, request):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2020, 2023, Hitachi, Ltd.
|
# Copyright (C) 2020, 2024, Hitachi, Ltd.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -495,8 +495,7 @@ class HBSDRESTISCSIDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(6, request.call_count)
|
self.assertEqual(6, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
@ -526,8 +525,7 @@ class HBSDRESTISCSIDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(9, request.call_count)
|
self.assertEqual(9, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
@ -557,8 +555,7 @@ class HBSDRESTISCSIDriverTest(test.TestCase):
|
|||||||
self.assertEqual(1, brick_get_connector_properties.call_count)
|
self.assertEqual(1, brick_get_connector_properties.call_count)
|
||||||
self.assertEqual(9, request.call_count)
|
self.assertEqual(9, request.call_count)
|
||||||
# stop the Loopingcall within the do_setup treatment
|
# stop the Loopingcall within the do_setup treatment
|
||||||
self.driver.common.client.keep_session_loop.stop()
|
drv.common.client.keep_session_loop.stop()
|
||||||
self.driver.common.client.keep_session_loop.wait()
|
|
||||||
|
|
||||||
@mock.patch.object(requests.Session, "request")
|
@mock.patch.object(requests.Session, "request")
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Hitachi driver `bug #2063317
|
||||||
|
<https://bugs.launchpad.net/cinder/+bug/2063317>`_: Fix test scripts to
|
||||||
|
avoid failing by unexpected response from psuedo REST API server
|
Loading…
Reference in New Issue
Block a user