Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
CORTX-33673: push multi thread testing program in test folder
Browse files Browse the repository at this point in the history
Signed-off-by: Tanuja Shinde <tanuja.shinde@seagate.com>
  • Loading branch information
tanujashinde0405 committed Aug 11, 2022
1 parent 8eb91d4 commit 6680ba7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions py-utils/src/utils/conf_store/conf_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ def lock(self, index: str, **kwargs):
if key == 'duration' and not isinstance(val, int):
raise ConfError(errno.EINVAL, "Invalid value %s for parameter %s", val, key)

owner = self._lock_owner if 'owner' not in kwargs.keys() else kwargs['owner']
domain = self._lock_domain if 'domain' not in kwargs.keys() else kwargs['domain']
duration = self._lock_duration if 'duration' not in kwargs.keys() else kwargs['duration']
owner = self._lock_owner if 'owner' not in kwargs else kwargs['owner']
domain = self._lock_domain if 'domain' not in kwargs else kwargs['domain']
duration = self._lock_duration if 'duration' not in kwargs else kwargs['duration']

rc = False
if self.test_lock(index, owner=owner, domain=domain):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os
import sys
from multiprocessing import Process
import random
from datetime import datetime
Expand All @@ -10,11 +8,11 @@
class TestConfStoreLock(object):
"""Test Confstore lock."""
lock_status = []
def __init__(self, URL="consul://ssc-vm-g3-rhev4-3306.colo.seagate.com/conf10"):
def __init__(self, URL="consul://cortx-consul-server:8500/test_lock"):
self.url = URL
self.duration = 20

def test_lock_race(self, thread_count:int=2, repeat=1):
def test_lock_race(self, thread_count:int = 2, repeat = 1):
"""Test race condition with lock."""
_index = None
_conf_index = TestConfStoreLock._generate_index()
Expand All @@ -28,7 +26,7 @@ def test_lock_race(self, thread_count:int=2, repeat=1):
for _proc in _process_store:
_proc.start()

def test_multiple_lock_unlock(self, thread_count:int=2, repeat=1):
def test_multiple_lock_unlock(self, thread_count:int = 2, repeat = 1):
"""Test race condition with lock."""
_index = None
_conf_index = TestConfStoreLock._generate_index()
Expand All @@ -38,7 +36,7 @@ def test_multiple_lock_unlock(self, thread_count:int=2, repeat=1):
Conf.load(_index, self.url)
_conf_process = Process(target=self.lock_unlock, args=(_index, repeat), kwargs={ "owner": _index, "duration":self.duration})
_process_store.append(_conf_process)

for _proc in _process_store:
_proc.start()
_proc.join()
Expand Down

0 comments on commit 6680ba7

Please sign in to comment.