def test_ocs_336(self, test_fixture): """ Testing basics: secret creation, storage class creation and pvc with cephfs """ self.cephfs_secret = defaults.CSI_CEPHFS_SECRET.copy() del self.cephfs_secret['data']['userID'] del self.cephfs_secret['data']['userKey'] self.cephfs_secret['data']['adminKey'] = ( get_admin_key_from_ceph_tools()) self.cephfs_secret['data']['adminID'] = constants.ADMIN_BASE64 logging.info(self.cephfs_secret) secret = OCS(**self.cephfs_secret) secret.create() self.cephfs_sc = defaults.CSI_CEPHFS_STORAGECLASS_DICT.copy() self.cephfs_sc['parameters']['monitors'] = self.mons self.cephfs_sc['parameters']['pool'] = ( f"{self.fs_data['metadata']['name']}-data0") storage_class = OCS(**self.cephfs_sc) storage_class.create() self.cephfs_pvc = defaults.CSI_CEPHFS_PVC.copy() pvc = PVC(**self.cephfs_pvc) pvc.create() log.info(pvc.status) assert 'Bound' in pvc.status pvc.delete() storage_class.delete() secret.delete()
def invalid_storageclass(request): """ Creates a CephFS or RBD StorageClass with invalid parameters. Storageclass is removed at the end of test. Returns: str: Name of created StorageClass """ logger.info(f"SETUP - creating storageclass " f"{request.param['values']['storageclass_name']}") yaml_path = os.path.join(request.param['template_dir'], "storageclass.yaml") yaml_data = yaml.safe_load(open(yaml_path, 'r')) yaml_data.update(request.param['values']) storageclass = OCS(**yaml_data) sc_data = storageclass.create() logger.debug('Check that storageclass has assigned creationTimestamp') assert sc_data['metadata']['creationTimestamp'] yield sc_data logger.info(f"TEARDOWN - removing storageclass " f"{request.param['values']['storageclass_name']}") storageclass.delete()
def test_ocs_346(self): """ Testing basics: secret creation, storage class creation and pvc with rbd """ self.rbd_secret = defaults.CSI_RBD_SECRET.copy() del self.rbd_secret['data']['kubernetes'] self.rbd_secret['data']['admin'] = get_admin_key_from_ceph_tools() logging.info(self.rbd_secret) secret = OCS(**self.rbd_secret) secret.create() self.rbd_sc = defaults.CSI_RBD_STORAGECLASS_DICT.copy() self.rbd_sc['parameters']['monitors'] = self.mons del self.rbd_sc['parameters']['userid'] storage_class = OCS(**self.rbd_sc) storage_class.create() self.rbd_pvc = defaults.CSI_RBD_PVC.copy() pvc = PVC(**self.rbd_pvc) pvc.create() assert 'Bound' in pvc.status pvc.delete() storage_class.delete() secret.delete()