Yoav Kleinberger has uploaded a new change for review.

Change subject: tests: revive camelCase convention
......................................................................

tests: revive camelCase convention

I can't look at those underscores

Change-Id: I4125f87f0506736d50d3a8c35b7b38fa9e1007f1
Signed-off-by: Yoav Kleinberger <[email protected]>
---
M tests/functional/new/basicLocalFSStorageDomainTest.py
M tests/functional/new/testlib/controlvdsm.py
M tests/functional/new/testlib/testcontexts/localfs.py
M tests/functional/new/testlib/vdsmtestcontext.py
4 files changed, 93 insertions(+), 97 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/31983/1

diff --git a/tests/functional/new/basicLocalFSStorageDomainTest.py 
b/tests/functional/new/basicLocalFSStorageDomainTest.py
index bcbcd09..3750c40 100644
--- a/tests/functional/new/basicLocalFSStorageDomainTest.py
+++ b/tests/functional/new/basicLocalFSStorageDomainTest.py
@@ -13,42 +13,40 @@
 
 class TestBasicLocalFSStorageDomain:
     def setup(self):
-        control_vdsm = controlvdsm.ControlVDSM()
-        control_vdsm.cleanup()
+        controlVDSM = controlvdsm.ControlVDSM()
+        controlVDSM.cleanup()
 
     def test_create_and_destroy_storage_domain(self):
-        with vdsmtestcontext.vdsm_test_context('localfs') as (vdsm, verify):
-            storage_server_id = str(uuid.uuid4())
-            vdsm.connect_storage_server(storage_server_id)
-            verify.storage_server_connected()
+        with vdsmtestcontext.vdsmTestContext('localfs') as (vdsm, verify):
+            storageServerID = vdsm.connectStorageServer()
+            verify.storageServerConnected()
 
-            domain_id = vdsm.create_local_filesystem_storage_domain()
-            verify.storage_domain_created(domain_id)
+            domainID = vdsm.createLocalFilesystemStorageDomain()
+            verify.storageDomainCreated(domainID)
 
-            vdsm.format_storage_domain(domain_id)
-            verify.storage_domain_gone(domain_id)
+            vdsm.formatStorageDomain(domainID)
+            verify.storageDomainGone(domainID)
 
-            vdsm.disconnect_storage_server(storage_server_id)
-            verify.storage_server_disconnected()
+            vdsm.disconnectStorageServer(storageServerID)
+            verify.storageServerDisconnected()
 
     def test_create_volume(self):
-        with vdsmtestcontext.vdsm_test_context('localfs') as (vdsm, verify):
-            storage_server_id = str(uuid.uuid4())
-            vdsm.connect_storage_server(storage_server_id)
-            verify.storage_server_connected()
+        with vdsmtestcontext.vdsmTestContext('localfs') as (vdsm, verify):
+            storageServerID = vdsm.connectStorageServer()
+            verify.storageServerConnected()
 
-            domain_id = vdsm.create_local_filesystem_storage_domain()
-            verify.storage_domain_created(domain_id)
+            domainID = vdsm.createLocalFilesystemStorageDomain()
+            verify.storageDomainCreated(domainID)
 
-            pool_id = str(uuid.uuid4())
-            vdsm.create_storage_pool('my pool', pool_id, domain_id, [ 
domain_id ] )
-            verify.storage_pool_created(pool_id, domain_id)
+            poolID = str(uuid.uuid4())
+            vdsm.createStoragePool('my pool', poolID, domainID, [ domainID ] )
+            verify.storagePoolCreated(poolID, domainID)
 
-            vdsm.connect_storage_pool(pool_id, master_domain_id = domain_id)
-            vdsm.spm_start(pool_id)
-            verify.spm_started(pool_id, domain_id)
-            image_id = str(uuid.uuid4())
-            volume_id = str(uuid.uuid4())
+            vdsm.connectStoragePool(poolID, masterDomainID = domainID)
+            vdsm.spmStart(poolID)
+            verify.spmStarted(poolID, domainID)
+            imageID = str(uuid.uuid4())
+            volumeID = str(uuid.uuid4())
             GIGABYTE = 1024 ** 3
-            vdsm.create_volume(domain_id, pool_id, image_id, 1 * GIGABYTE, 
storage.volume.RAW_FORMAT, storage.volume.SPARSE_VOL, 
storage.image.DATA_DISK_TYPE, volume_id, 'a volume description')
-            verify.volume_created(domain_id, image_id, volume_id)
+            vdsm.createVolume(domainID, poolID, imageID, 1 * GIGABYTE, 
storage.volume.RAW_FORMAT, storage.volume.SPARSE_VOL, 
storage.image.DATA_DISK_TYPE, volumeID, 'a volume description')
+            verify.volumeCreated(domainID, imageID, volumeID)
diff --git a/tests/functional/new/testlib/controlvdsm.py 
b/tests/functional/new/testlib/controlvdsm.py
index 2594ee6..b7b8249 100644
--- a/tests/functional/new/testlib/controlvdsm.py
+++ b/tests/functional/new/testlib/controlvdsm.py
@@ -7,13 +7,13 @@
 
 class ControlVDSM:
     def cleanup(self):
-        self._stop_service()
-        assert not self._service_running()
-        self._brutally_clean_files()
-        self._restart_service()
-        return self._check_connection()
+        self._stopService()
+        assert not self._serviceRunning()
+        self._brutallyCleanFiles()
+        self._restartService()
+        return self._checkConnection()
 
-    def _check_connection(self):
+    def _checkConnection(self):
         useSSL = vdsm.config.config.getboolean('vars', 'ssl')
         vdsmClient = vdsm.vdscli.connect(useSSL=useSSL)
         RETRIES = 5
@@ -28,26 +28,26 @@
 
         raise Exception('could not connect to VDSM')
 
-    def _stop_service(self):
+    def _stopService(self):
         self._run("sudo service vdsmd stop")
 
-    def _service_running(self):
-        return_code = subprocess.call('sudo service vdsmd status', shell=True, 
stdout=open('/dev/null','w'), stderr=open('/dev/null','w'))
-        logging.info('vdsm running: %s' % (return_code == 0))
-        return return_code == 0
+    def _serviceRunning(self):
+        returnCode = subprocess.call('sudo service vdsmd status', shell=True, 
stdout=open('/dev/null','w'), stderr=open('/dev/null','w'))
+        logging.info('vdsm running: %s' % (returnCode == 0))
+        return returnCode == 0
 
-    def _restart_service(self):
+    def _restartService(self):
         self._run("sudo vdsm-tool configure --force")
         self._run("sudo service vdsmd start")
         
     def _run(self, command):
         logging.info('running: %s' % command)
-        return_code = subprocess.call(command, shell=True, close_fds=True, 
stdout=open('/dev/null','w'), stderr=open('/dev/null','w'))
-        if return_code != 0:
+        returnCode = subprocess.call(command, shell=True, close_fds=True, 
stdout=open('/dev/null','w'), stderr=open('/dev/null','w'))
+        if returnCode != 0:
             logging.warning('failure! command was: %s' % command)
         else:
             logging.info('finished.')
 
-    def _brutally_clean_files(self):
+    def _brutallyCleanFiles(self):
         logging.warning('removing /rhev/data-center without asking too many 
questions')
         self._run('sudo rm -fr /rhev/data-center/*')
diff --git a/tests/functional/new/testlib/testcontexts/localfs.py 
b/tests/functional/new/testlib/testcontexts/localfs.py
index 1bf53b2..86992c2 100644
--- a/tests/functional/new/testlib/testcontexts/localfs.py
+++ b/tests/functional/new/testlib/testcontexts/localfs.py
@@ -13,13 +13,13 @@
     def __init__(self, directory):
         self._directory = directory
 
-    def assert_path_exists(self, path, link = False):
+    def assertPathExists(self, path, link = False):
         if link:
             assert os.path.lexists(path)
         else:
             assert os.path.exists(path)
 
-    def assert_path_does_not_exist(self, path, link = False):
+    def assertPathDoesNotExist(self, path, link = False):
         if link:
             assert not os.path.lexists(path)
         else:
@@ -28,63 +28,63 @@
     def _waitForVDSMToFinishTask(self):
         time.sleep(1)
         
-    def storage_server_connected(self):
+    def storageServerConnected(self):
         self._waitForVDSMToFinishTask()
         transformedDirectory = self._directory.replace( '/', '_' )
         expectedSymlink = os.path.join('/rhev/data-center/mnt/', 
transformedDirectory)
-        self.assert_path_exists(expectedSymlink, link = True)
+        self.assertPathExists(expectedSymlink, link = True)
 
-    def storage_domain_gone(self, domainID):
+    def storageDomainGone(self, domainID):
         self._waitForVDSMToFinishTask()
         domainRoot = os.path.join(self._directory, domainID)
-        self.assert_path_does_not_exist(domainRoot)
+        self.assertPathDoesNotExist(domainRoot)
 
-    def storage_server_disconnected(self):
+    def storageServerDisconnected(self):
         self._waitForVDSMToFinishTask()
         transformedDirectory = self._directory.replace( '/', '_' )
         expectedSymlink = os.path.join('/rhev/data-center/mnt/', 
transformedDirectory)
-        self.assert_path_does_not_exist(expectedSymlink)
+        self.assertPathDoesNotExist(expectedSymlink)
 
-    def direct_io_test_file_exists(self):
+    def storageDomainCreated(self, domainID):
         self._waitForVDSMToFinishTask()
-        directIOTestFile = os.path.join(self._directory, '__DIRECT_IO_TEST__')
-        self.assert_path_exists(directIOTestFile)
-
-    def storage_domain_created(self, domainID):
-        self._waitForVDSMToFinishTask()
-        self.direct_io_test_file_exists()
+        self._directIOTestFileExists()
         domainRoot = os.path.join(self._directory, domainID)
         expectedFiles = [ 'images', 'dom_md', 'dom_md/leases', 'dom_md/inbox', 
'dom_md/outbox', 'dom_md/metadata', 'dom_md/ids' ]
         expectedFullPaths = [ os.path.join(domainRoot, path) for path in 
expectedFiles ]
         for path in expectedFullPaths:
             assert os.path.exists(path)
 
-    def storage_pool_created(self, pool_id, master_storage_domain_id):
+    def _directIOTestFileExists(self):
         self._waitForVDSMToFinishTask()
-        link_to_domain = os.path.join('/rhev/data-center', pool_id, 
master_storage_domain_id)
-        alias_link = os.path.join('/rhev/data-center', pool_id, 'mastersd')
-        assert os.path.lexists(link_to_domain)
-        assert os.path.lexists(alias_link)
+        directIOTestFile = os.path.join(self._directory, '__DIRECT_IO_TEST__')
+        self.assertPathExists(directIOTestFile)
 
-    def spm_started(self, pool_id, master_domain_id):
+    def storagePoolCreated(self, poolID, master_storage_domainID):
         self._waitForVDSMToFinishTask()
-        domainDirectory = os.path.join(self._directory, master_domain_id)
+        linkToDomain = os.path.join('/rhev/data-center', poolID, 
master_storage_domainID)
+        masterAliasLink = os.path.join('/rhev/data-center', poolID, 'mastersd')
+        assert os.path.lexists(linkToDomain)
+        assert os.path.lexists(masterAliasLink)
+
+    def spmStarted(self, poolID, masterDomainID):
+        self._waitForVDSMToFinishTask()
+        domainDirectory = os.path.join(self._directory, masterDomainID)
         master = os.path.join(domainDirectory, 'master')
         tasks = os.path.join(master, 'tasks')
         vms = os.path.join(master, 'vms')
         for path in master, tasks, vms:
-            self.assert_path_exists(path)
+            self.assertPathExists(path)
 
-    def volume_created(self, domain_id, image_id, volume_id):
+    def volumeCreated(self, domainID, imageID, volumeID):
         self._waitForVDSMToFinishTask()
-        domain_directory = os.path.join(self._directory, domain_id)
-        image_directory = os.path.join(domain_directory, 'images', image_id)
-        self.assert_path_exists(image_directory)
-        volume_file = os.path.join(image_directory, volume_id)
+        domain_directory = os.path.join(self._directory, domainID)
+        image_directory = os.path.join(domain_directory, 'images', imageID)
+        self.assertPathExists(image_directory)
+        volume_file = os.path.join(image_directory, volumeID)
         volume_lease = '%s.lease' % volume_file
         volume_meta = '%s.meta' % volume_file
         for path in volume_file, volume_lease, volume_meta:
-            self.assert_path_exists(path)
+            self.assertPathExists(path)
 
 class LocalFS:
     _NON_EXISTANT_POOL = '00000000-0000-0000-0000-000000000000'
@@ -93,10 +93,10 @@
         self._vdsm = vdsm.vdscli.connect(useSSL=useSSL)
 
     def __enter__(self):
-        self._create_directory_for_localfs_storage()
+        self._createDirectoryForLocalFSStorage()
         return self, Verify(self._directory)
 
-    def _create_directory_for_localfs_storage(self):
+    def _createDirectoryForLocalFSStorage(self):
         self._directory = tempfile.mkdtemp('', 'localfstest', '/var/tmp')
         vdsm_user = pwd.getpwnam('vdsm')
         os.chown(self._directory, vdsm_user.pw_uid, vdsm_user.pw_gid)
@@ -105,57 +105,55 @@
     def __exit__(self, *args):
         shutil.rmtree(self._directory)
 
-    def connect_storage_server(self, storageServerID):
+    def connectStorageServer(self):
+        storageServerID = str(uuid.uuid4())
         localFilesystemConnection = {'connection': self._directory, 'iqn': '', 
'user': '', 'tpgt': '1', 'password': '******', 'id': storageServerID, 'port': 
''}
         result = self._vdsm.connectStorageServer(
                                 storage.sd.LOCALFS_DOMAIN,
                                 self._NON_EXISTANT_POOL,
                                 [ localFilesystemConnection ])
-        self.verify_vdsm_success(result)
+        self.verifyVDSMSuccess(result)
         assert result[ 'statuslist' ][ 0 ][ 'id' ] == storageServerID
+        return storageServerID
 
-    def disconnect_storage_server(self, storageServerID):
+    def disconnectStorageServer(self, storageServerID):
         localFilesystemConnection = {'connection': self._directory, 'iqn': '', 
'user': '', 'tpgt': '1', 'password': '******', 'id': storageServerID, 'port': 
''}
         result = self._vdsm.disconnectStorageServer(
                                 storage.sd.LOCALFS_DOMAIN,
                                 self._NON_EXISTANT_POOL,
                                 [ localFilesystemConnection ])
-        self.verify_vdsm_success(result)
+        self.verifyVDSMSuccess(result)
 
-    def create_storage_pool(self, name, id, master_domain_id, domain_ids):
+    def createStoragePool(self, name, id, masterDomainID, domainIDs):
         POOL_TYPE_DEPRECATED = 0
-        result = self._vdsm.createStoragePool(0, id, name, master_domain_id, 
domain_ids, 1)
-        self.verify_vdsm_success(result)
+        result = self._vdsm.createStoragePool(0, id, name, masterDomainID, 
domainIDs, 1)
+        self.verifyVDSMSuccess(result)
 
-    def connect_storage_pool(self, id, master_domain_id):
+    def connectStoragePool(self, id, masterDomainID):
         SCSI_KEY_DEPRECATED = 0
-        result = self._vdsm.connectStoragePool(id, 1, SCSI_KEY_DEPRECATED, 
master_domain_id, 1)
-        self.verify_vdsm_success(result)
+        result = self._vdsm.connectStoragePool(id, 1, SCSI_KEY_DEPRECATED, 
masterDomainID, 1)
+        self.verifyVDSMSuccess(result)
 
-    def spm_start(self, poolID):
+    def spmStart(self, poolID):
         RECOVERY_MODE_DEPRECATED = 0
         SCSI_FENCING_DEPRECATED = 0
         result = self._vdsm.spmStart(poolID, -1, '-1', 
SCSI_FENCING_DEPRECATED, RECOVERY_MODE_DEPRECATED)
-        self.verify_vdsm_success(result)
+        self.verifyVDSMSuccess(result)
 
-    def create_local_filesystem_storage_domain(self):
+    def createLocalFilesystemStorageDomain(self):
         domainID = str(uuid.uuid4())
         DOMAIN_VERSION = 3
         result = self._vdsm.createStorageDomain(storage.sd.LOCALFS_DOMAIN, 
domainID, 'some_name', self._directory, storage.sd.DATA_DOMAIN, DOMAIN_VERSION)
-        self.verify_vdsm_success(result)
+        self.verifyVDSMSuccess(result)
         return domainID
 
-    def create_volume(self, domainID, poolID, imageID, size, format, 
preallocate, diskType, volumeID, description):
+    def createVolume(self, domainID, poolID, imageID, size, format, 
preallocate, diskType, volumeID, description):
         result = self._vdsm.createVolume(domainID, poolID, imageID, size, 
format, preallocate, diskType, volumeID, description)
-        self.verify_vdsm_success(result)
+        self.verifyVDSMSuccess(result)
 
-    def delete_image(self, domainID, poolID, imageID):
-        result = self._vdsm.deleteImage(domainID, poolID, imageID)
-        self.verify_vdsm_success(result)
-
-    def verify_vdsm_success(self, result):
+    def verifyVDSMSuccess(self, result):
         if result[ 'status' ][ 'code' ] != 0:
             raise Exception('expected OK result from VDSM, got "%s" instead' % 
str(result))
 
-    def format_storage_domain(self, domainID):
+    def formatStorageDomain(self, domainID):
         self._vdsm.formatStorageDomain(domainID)
diff --git a/tests/functional/new/testlib/vdsmtestcontext.py 
b/tests/functional/new/testlib/vdsmtestcontext.py
index 3c1d447..358d03e 100644
--- a/tests/functional/new/testlib/vdsmtestcontext.py
+++ b/tests/functional/new/testlib/vdsmtestcontext.py
@@ -1,5 +1,5 @@
 import testcontexts.localfs
 
-def vdsm_test_context(storageType):
+def vdsmTestContext(storageType):
     MAP = {'localfs': testcontexts.localfs.LocalFS}
     return MAP[storageType]()


-- 
To view, visit http://gerrit.ovirt.org/31983
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4125f87f0506736d50d3a8c35b7b38fa9e1007f1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yoav Kleinberger <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to