def test_select_domains(self, scan_pattern, sd_type): with fake_repo() as repo, namedTemporaryDir() as tmpdir: file_sd = add_filesd(repo, "nfs.server:/path", str(uuid.uuid4())) gluster_sd = add_filesd(repo, "gluster.server:/volname", str(uuid.uuid4()), subdir=sd.GLUSTERSD_DIR) local_sd = add_localsd(repo, tmpdir, str(uuid.uuid4())) domains = {"gluster": [gluster_sd], "local": [local_sd], "all": [file_sd, gluster_sd, local_sd]} expected = set([(domain.uuid, domain.dom_dir) for domain in domains[sd_type]]) self.assertEqual(set(fileSD.scanDomains(scan_pattern)), expected)
def test_nfs_with_IPV6_address(self): with fake_repo() as repo: nfs_sd = add_filesd(repo, "[201::1]:/path", str(uuid.uuid4())) self.assertEqual(list(fileSD.scanDomains()), [(nfs_sd.uuid, nfs_sd.dom_dir)])
def test_no_sd(self): with fake_repo(): self.assertEqual(list(fileSD.scanDomains()), [])
def test_detect_filesd(self): with fake_repo() as repo: sd = add_filesd(repo, "server:/path", str(uuid.uuid4())) self.assertEqual(fileSD.getStorageDomainsList(), [sd.uuid])
def test_no_sd(self): with fake_repo(): self.assertEqual(fileSD.getStorageDomainsList(), [])