diff --git a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_mirror_fc.py b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_mirror_fc.py index 643faa4e135..4afcf6f80f1 100644 --- a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_mirror_fc.py +++ b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_mirror_fc.py @@ -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 # 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), drv.common.rep_secondary._PAIR_TARGET_NAME) # stop the Loopingcall within the do_setup treatment - self.driver.common.rep_primary.client.keep_session_loop.stop() - self.driver.common.rep_primary.client.keep_session_loop.wait() - self.driver.common.rep_secondary.client.keep_session_loop.stop() - self.driver.common.rep_secondary.client.keep_session_loop.wait() + drv.common.rep_primary.client.keep_session_loop.stop() + drv.common.rep_secondary.client.keep_session_loop.stop() self._setup_config() @mock.patch.object(requests.Session, "request") diff --git a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_fc.py b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_fc.py index 9946bacc8ea..f466d7e0940 100644 --- a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_fc.py +++ b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_fc.py @@ -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 # 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(4, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( @@ -674,8 +673,7 @@ class HBSDRESTFCDriverTest(test.TestCase): self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(9, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( @@ -703,8 +701,7 @@ class HBSDRESTFCDriverTest(test.TestCase): self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(9, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( @@ -756,8 +753,7 @@ class HBSDRESTFCDriverTest(test.TestCase): self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(10, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( @@ -783,8 +779,7 @@ class HBSDRESTFCDriverTest(test.TestCase): self.assertEqual(5, request.call_count) self.configuration.hitachi_pools = tmp_pools # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") def test_create_volume(self, request): diff --git a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_iscsi.py b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_iscsi.py index 004ad5d3ef9..b0344261dfc 100644 --- a/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_iscsi.py +++ b/cinder/tests/unit/volume/drivers/hitachi/test_hitachi_hbsd_rest_iscsi.py @@ -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 # 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(6, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( @@ -526,8 +525,7 @@ class HBSDRESTISCSIDriverTest(test.TestCase): self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(9, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( @@ -557,8 +555,7 @@ class HBSDRESTISCSIDriverTest(test.TestCase): self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(9, request.call_count) # stop the Loopingcall within the do_setup treatment - self.driver.common.client.keep_session_loop.stop() - self.driver.common.client.keep_session_loop.wait() + drv.common.client.keep_session_loop.stop() @mock.patch.object(requests.Session, "request") @mock.patch.object( diff --git a/releasenotes/notes/hitachi_fix-testscripts-e4490f9f99994fb8.yaml b/releasenotes/notes/hitachi_fix-testscripts-e4490f9f99994fb8.yaml new file mode 100644 index 00000000000..f6354693d9b --- /dev/null +++ b/releasenotes/notes/hitachi_fix-testscripts-e4490f9f99994fb8.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Hitachi driver `bug #2063317 + `_: Fix test scripts to + avoid failing by unexpected response from psuedo REST API server