Stop using deprecated zake coordination driver

The zake driver in tooz was deprecated[1] because the zake library has
been archived[2].

[1] 9acbc5391521155b04aa6654fb91c90b467b5750
[2] https://github.com/yahoo/Zake

Change-Id: I0e835858514d82b181c2898ccb87eb8ef72ad10c
This commit is contained in:
Takashi Kajinami 2024-01-21 23:57:54 +09:00
parent d29d39f559
commit 0f71235749
3 changed files with 32 additions and 24 deletions

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import shutil
import tempfile
from unittest import mock
from oslo_config import cfg
@ -24,7 +26,10 @@ from mistral.tests.unit.api import base
class TestServicesController(base.APITest):
def test_get_all(self):
cfg.CONF.set_default('backend_url', 'zake://', 'coordination')
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
coordination.cleanup_service_coordinator()
service_coordinator = coordination.get_service_coordinator(
@ -58,7 +63,10 @@ class TestServicesController(base.APITest):
@mock.patch('mistral.service.coordination.ServiceCoordinator.get_members',
side_effect=tooz.coordination.ToozError('error message'))
def test_get_all_with_get_members_error(self, mock_get_members):
cfg.CONF.set_default('backend_url', 'zake://', 'coordination')
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
coordination.cleanup_service_coordinator()
coordination.get_service_coordinator()

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import shutil
import tempfile
from unittest import mock
from oslo_config import cfg
@ -22,11 +24,10 @@ from mistral.tests.unit import base
class ServiceCoordinatorTest(base.BaseTest):
def test_start(self):
cfg.CONF.set_default(
'backend_url',
'zake://',
'coordination'
)
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
coordinator = coordination.ServiceCoordinator('fake_id')
coordinator.start()
@ -52,11 +53,10 @@ class ServiceCoordinatorTest(base.BaseTest):
self.assertFalse(coordinator.is_active())
def test_stop(self):
cfg.CONF.set_default(
'backend_url',
'zake://',
'coordination'
)
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
coordinator = coordination.ServiceCoordinator()
coordinator.start()
@ -79,11 +79,10 @@ class ServiceCoordinatorTest(base.BaseTest):
self.assertEqual(0, len(members))
def test_join_group_and_get_members(self):
cfg.CONF.set_default(
'backend_url',
'zake://',
'coordination'
)
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
coordinator = coordination.ServiceCoordinator(my_id='fake_id')
coordinator.start()
@ -95,11 +94,10 @@ class ServiceCoordinatorTest(base.BaseTest):
self.assertCountEqual(('fake_id'.encode("latin-1"),), members)
def test_join_group_and_leave_group(self):
cfg.CONF.set_default(
'backend_url',
'zake://',
'coordination'
)
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
coordinator = coordination.ServiceCoordinator(my_id='fake_id')
coordinator.start()
@ -128,7 +126,10 @@ class ServiceTest(base.BaseTest):
@mock.patch('mistral_lib.utils.get_process_identifier',
return_value='fake_id')
def test_register_membership(self, mock_get_identifier):
cfg.CONF.set_default('backend_url', 'zake://', 'coordination')
tempdir = tempfile.mkdtemp()
cfg.CONF.set_override('backend_url', "file://%s" % tempdir,
group='coordination')
self.addCleanup(shutil.rmtree, tempdir, ignore_errors=True)
srv = coordination.Service('fake_group')
srv.register_membership()

View File

@ -15,4 +15,3 @@ stestr>=2.0.0 # Apache-2.0
testtools>=2.2.0 # MIT
unittest2>=1.1.0 # BSD
WebTest>= 3.0.0 # Apache-2.0
zake>=0.1.6 # Apache-2.0