mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Reduce duplication in object store integration tests.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
from galaxy_test.base.populators import (
|
||||
DatasetPopulator,
|
||||
)
|
||||
from galaxy_test.driver import integration_util
|
||||
|
||||
|
||||
class BaseObjectStoreIntegrationTestCase(integration_util.IntegrationTestCase):
|
||||
|
||||
framework_tool_and_types = True
|
||||
|
||||
@classmethod
|
||||
def _configure_object_store(cls, template, config):
|
||||
temp_directory = cls._test_driver.mkdtemp()
|
||||
cls.object_stores_parent = temp_directory
|
||||
config_path = os.path.join(temp_directory, "object_store_conf.xml")
|
||||
xml = template.safe_substitute({"temp_directory": temp_directory})
|
||||
with open(config_path, "w") as f:
|
||||
f.write(xml)
|
||||
config["object_store_config_file"] = config_path
|
||||
for path in re.findall(r'files_dir path="([^"]*)"', xml):
|
||||
assert path.startswith(temp_directory)
|
||||
dir_name = os.path.basename(path)
|
||||
os.path.join(temp_directory, dir_name)
|
||||
os.makedirs(path)
|
||||
setattr(cls, "%s_path" % dir_name, path)
|
||||
|
||||
def setUp(self):
|
||||
super(BaseObjectStoreIntegrationTestCase, self).setUp()
|
||||
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
|
||||
@@ -3,10 +3,7 @@
|
||||
import os
|
||||
import string
|
||||
|
||||
from galaxy_test.base.populators import (
|
||||
DatasetPopulator,
|
||||
)
|
||||
from galaxy_test.driver import integration_util
|
||||
from ._base import BaseObjectStoreIntegrationTestCase
|
||||
|
||||
DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE = string.Template("""<?xml version="1.0"?>
|
||||
<object_store type="hierarchical">
|
||||
@@ -37,26 +34,14 @@ DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE = string.Template("""<?xml version="1.0
|
||||
TEST_INPUT_FILES_CONTENT = "1 2 3"
|
||||
|
||||
|
||||
class ObjectStoreJobsIntegrationTestCase(integration_util.IntegrationTestCase):
|
||||
|
||||
framework_tool_and_types = True
|
||||
class ObjectStoreJobsIntegrationTestCase(BaseObjectStoreIntegrationTestCase):
|
||||
|
||||
@classmethod
|
||||
def handle_galaxy_config_kwds(cls, config):
|
||||
temp_directory = cls._test_driver.mkdtemp()
|
||||
cls.object_stores_parent = temp_directory
|
||||
for disk_store_file_name in ["files1", "files2", "files3"]:
|
||||
disk_store_path = os.path.join(temp_directory, disk_store_file_name)
|
||||
os.makedirs(disk_store_path)
|
||||
setattr(cls, "%s_path" % disk_store_file_name, disk_store_path)
|
||||
config_path = os.path.join(temp_directory, "object_store_conf.xml")
|
||||
with open(config_path, "w") as f:
|
||||
f.write(DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE.safe_substitute({"temp_directory": temp_directory}))
|
||||
config["object_store_config_file"] = config_path
|
||||
cls._configure_object_store(DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE, config)
|
||||
|
||||
def setUp(self):
|
||||
super(ObjectStoreJobsIntegrationTestCase, self).setUp()
|
||||
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
hda1 = self.dataset_populator.new_dataset(history_id, content=TEST_INPUT_FILES_CONTENT)
|
||||
create_10_inputs = {
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
import os
|
||||
import string
|
||||
|
||||
from galaxy_test.base.populators import (
|
||||
DatasetPopulator,
|
||||
)
|
||||
from galaxy_test.driver import integration_util
|
||||
from ._base import BaseObjectStoreIntegrationTestCase
|
||||
|
||||
SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
|
||||
JOB_CONFIG_FILE = os.path.join(SCRIPT_DIRECTORY, "selection_job_conf.xml")
|
||||
@@ -40,29 +37,14 @@ DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE = string.Template("""<?xml version="1.0
|
||||
""")
|
||||
|
||||
|
||||
class ObjectStoreJobsIntegrationTestCase(integration_util.IntegrationTestCase):
|
||||
|
||||
framework_tool_and_types = True
|
||||
class ObjectStoreSelectionIntegrationTestCase(BaseObjectStoreIntegrationTestCase):
|
||||
|
||||
@classmethod
|
||||
def handle_galaxy_config_kwds(cls, config):
|
||||
temp_directory = cls._test_driver.mkdtemp()
|
||||
cls.object_stores_parent = temp_directory
|
||||
for disk_store_file_name in ["files_default", "files_static", "files_dynamic_ebs", "files_dynamic_s3"]:
|
||||
disk_store_path = os.path.join(temp_directory, disk_store_file_name)
|
||||
os.makedirs(disk_store_path)
|
||||
setattr(cls, "%s_path" % disk_store_file_name, disk_store_path)
|
||||
config_path = os.path.join(temp_directory, "object_store_conf.xml")
|
||||
with open(config_path, "w") as f:
|
||||
f.write(DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE.safe_substitute({"temp_directory": temp_directory}))
|
||||
config["object_store_config_file"] = config_path
|
||||
cls._configure_object_store(DISTRIBUTED_OBJECT_STORE_CONFIG_TEMPLATE, config)
|
||||
config["job_config_file"] = JOB_CONFIG_FILE
|
||||
config["job_resource_params_file"] = JOB_RESOURCE_PARAMETERS_CONFIG_FILE
|
||||
|
||||
def setUp(self):
|
||||
super(ObjectStoreJobsIntegrationTestCase, self).setUp()
|
||||
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
|
||||
|
||||
def _object_store_counts(self):
|
||||
files_default_count = _files_count(self.files_default_path)
|
||||
files_static_count = _files_count(self.files_static_path)
|
||||
|
||||
Reference in New Issue
Block a user