Skip to content

Commit

Permalink
Rename classes derived from IntegrationInstance which are not tes…
Browse files Browse the repository at this point in the history
…t cases
  • Loading branch information
nsoranzo committed Feb 16, 2024
1 parent dcd739a commit 6ffdf84
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
36 changes: 20 additions & 16 deletions test/integration/objectstore/test_objectstore_datatype_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
TEST_CASES,
TestData,
upload_datatype_helper,
UploadTestDatatypeDataTestCase,
UploadTestDatatypeDataIntegrationInstance,
)

REFRESH_TIME = 3
Expand Down Expand Up @@ -119,7 +119,7 @@ def stop_irods(container_name):
subprocess.check_call(["docker", "rm", "-f", container_name])


class BaseObjectstoreUploadTest(UploadTestDatatypeDataTestCase):
class BaseObjectstoreUploadIntegrationInstance(UploadTestDatatypeDataIntegrationInstance):
object_store_template: Optional[string.Template] = None

@classmethod
Expand All @@ -140,19 +140,19 @@ def get_object_store_kwargs(cls):
return {}


class IrodsUploadTestDatatypeDataTestCase(BaseObjectstoreUploadTest):
class IrodsUploadTestDatatypeDataIntegrationInstance(BaseObjectstoreUploadIntegrationInstance):
object_store_template = IRODS_OBJECT_STORE_CONFIG

@classmethod
def setUpClass(cls):
cls.container_name = "irods_integration_container"
start_irods(cls.container_name)
super(UploadTestDatatypeDataTestCase, cls).setUpClass()
super().setUpClass()

@classmethod
def tearDownClass(cls):
stop_irods(cls.container_name)
super(UploadTestDatatypeDataTestCase, cls).tearDownClass()
super().tearDownClass()

@classmethod
def get_object_store_kwargs(cls):
Expand All @@ -170,55 +170,59 @@ def get_object_store_kwargs(cls):
}


class IrodsIdleConnectionUploadTestCase(IrodsUploadTestDatatypeDataTestCase):
class IrodsIdleConnectionUploadIntegrationInstance(IrodsUploadTestDatatypeDataIntegrationInstance):
object_store_template = IRODS_OBJECT_STORE_CONFIG


class UploadTestDosDiskAndDiskTestCase(BaseObjectstoreUploadTest):
class UploadTestDosDiskAndDiskIntegrationInstance(BaseObjectstoreUploadIntegrationInstance):
object_store_template = DISTRIBUTED_OBJECT_STORE_CONFIG

@classmethod
def get_object_store_kwargs(cls):
return {"temp_directory": cls.object_stores_parent}


class UploadTestDosIrodsAndDiskTestCase(IrodsUploadTestDatatypeDataTestCase):
class UploadTestDosIrodsAndDiskIntegrationInstance(IrodsUploadTestDatatypeDataIntegrationInstance):
object_store_template = DISTRIBUTED_IRODS_OBJECT_STORE_CONFIG


distributed_instance = integration_util.integration_module_instance(UploadTestDosDiskAndDiskTestCase)
irods_instance = integration_util.integration_module_instance(IrodsUploadTestDatatypeDataTestCase)
distributed_and_irods_instance = integration_util.integration_module_instance(UploadTestDosIrodsAndDiskTestCase)
idle_connection_irods_instance = integration_util.integration_module_instance(IrodsIdleConnectionUploadTestCase)
distributed_instance = integration_util.integration_module_instance(UploadTestDosDiskAndDiskIntegrationInstance)
irods_instance = integration_util.integration_module_instance(IrodsUploadTestDatatypeDataIntegrationInstance)
distributed_and_irods_instance = integration_util.integration_module_instance(
UploadTestDosIrodsAndDiskIntegrationInstance
)
idle_connection_irods_instance = integration_util.integration_module_instance(
IrodsIdleConnectionUploadIntegrationInstance
)


@pytest.mark.parametrize("test_data", TEST_CASES.values(), ids=list(TEST_CASES.keys()))
def test_upload_datatype_dos_disk_and_disk(
distributed_instance: UploadTestDosDiskAndDiskTestCase, test_data: TestData, temp_file
distributed_instance: UploadTestDosDiskAndDiskIntegrationInstance, test_data: TestData, temp_file
) -> None:
with distributed_instance.dataset_populator.test_history() as history_id:
upload_datatype_helper(distributed_instance, test_data, temp_file, history_id)


@pytest.mark.parametrize("test_data", TEST_CASES.values(), ids=list(TEST_CASES.keys()))
def test_upload_datatype_irods(
irods_instance: IrodsUploadTestDatatypeDataTestCase, test_data: TestData, temp_file
irods_instance: IrodsUploadTestDatatypeDataIntegrationInstance, test_data: TestData, temp_file
) -> None:
with irods_instance.dataset_populator.test_history() as history_id:
upload_datatype_helper(irods_instance, test_data, temp_file, history_id, True)


@pytest.mark.parametrize("test_data", TEST_CASES.values(), ids=list(TEST_CASES.keys()))
def test_upload_datatype_dos_irods_and_disk(
distributed_and_irods_instance: UploadTestDosIrodsAndDiskTestCase, test_data: TestData, temp_file
distributed_and_irods_instance: UploadTestDosIrodsAndDiskIntegrationInstance, test_data: TestData, temp_file
) -> None:
with distributed_and_irods_instance.dataset_populator.test_history() as history_id:
upload_datatype_helper(distributed_and_irods_instance, test_data, temp_file, history_id)


@pytest.mark.parametrize("test_data", SINGLE_TEST_CASE.values(), ids=list(SINGLE_TEST_CASE.keys()))
def test_upload_datatype_irods_idle_connections(
idle_connection_irods_instance: IrodsIdleConnectionUploadTestCase, test_data: TestData, temp_file
idle_connection_irods_instance: IrodsIdleConnectionUploadIntegrationInstance, test_data: TestData, temp_file
) -> None:
with idle_connection_irods_instance.dataset_populator.test_history() as history_id:
upload_datatype_helper(idle_connection_irods_instance, test_data, temp_file, history_id, True)
Expand Down
14 changes: 7 additions & 7 deletions test/integration/test_datatype_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)
from galaxy.util.hash_util import md5_hash_file
from galaxy_test.driver import integration_util
from .test_upload_configuration_options import BaseUploadContentConfigurationInstance
from .test_upload_configuration_options import BaseUploadContentConfigurationIntegrationInstance

SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
TEST_FILE_DIR = f"{SCRIPT_DIRECTORY}/../../lib/galaxy/datatypes/test"
Expand Down Expand Up @@ -42,14 +42,14 @@ def collect_test_data(registry):
return {os.path.basename(data.path): data for data in test_data_description}


class UploadTestDatatypeDataTestCase(BaseUploadContentConfigurationInstance):
class UploadTestDatatypeDataIntegrationInstance(BaseUploadContentConfigurationIntegrationInstance):
framework_tool_and_types = False
datatypes_conf_override = DATATYPES_CONFIG
object_store_config = None
object_store_config_path = None


instance = integration_util.integration_module_instance(UploadTestDatatypeDataTestCase)
instance = integration_util.integration_module_instance(UploadTestDatatypeDataIntegrationInstance)


registry = Registry()
Expand All @@ -59,7 +59,7 @@ class UploadTestDatatypeDataTestCase(BaseUploadContentConfigurationInstance):

@pytest.mark.parametrize("test_data", TEST_CASES.values(), ids=list(TEST_CASES.keys()))
def test_upload_datatype_auto(
instance: UploadTestDatatypeDataTestCase,
instance: UploadTestDatatypeDataIntegrationInstance,
test_data: TestData,
temp_file,
celery_session_worker,
Expand All @@ -70,7 +70,7 @@ def test_upload_datatype_auto(


def upload_datatype_helper(
instance: UploadTestDatatypeDataTestCase,
instance: UploadTestDatatypeDataIntegrationInstance,
test_data: TestData,
temp_file,
history_id: str,
Expand Down Expand Up @@ -119,9 +119,9 @@ def upload_datatype_helper(
# Delete cache directory and then re-create it. This way we confirm
# that dataset is fetched from the object store, not from the cache
if TYPE_CHECKING:
from .objectstore.test_objectstore_datatype_upload import BaseObjectstoreUploadTest
from .objectstore.test_objectstore_datatype_upload import BaseObjectstoreUploadIntegrationInstance

assert isinstance(instance, BaseObjectstoreUploadTest)
assert isinstance(instance, BaseObjectstoreUploadIntegrationInstance)
temp_dir = instance.get_object_store_kwargs()["temp_directory"]
cache_dir = temp_dir + "/object_store_cache"
shutil.rmtree(cache_dir)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test_flush_per_n_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from galaxy_test.driver import integration_util


class FlushPerNDatasetsTestCase(integration_util.IntegrationInstance):
class FlushPerNDatasetsIntegrationInstance(integration_util.IntegrationInstance):
"""Describe a Galaxy test instance with embedded pulsar configured."""

framework_tool_and_types = True
Expand All @@ -14,7 +14,7 @@ def handle_galaxy_config_kwds(cls, config):
config["flush_per_n_datasets"] = 1


instance = integration_util.integration_module_instance(FlushPerNDatasetsTestCase)
instance = integration_util.integration_module_instance(FlushPerNDatasetsIntegrationInstance)
test_tools = integration_util.integration_tool_runner(
["collection_creates_dynamic_nested", "collection_creates_dynamic_list_of_pairs"]
)
4 changes: 2 additions & 2 deletions test/integration/test_legacy_store_by.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def setUp(self):
self.workflow_populator = WorkflowPopulator(self.galaxy_interactor)


class StoreByIdTestCase(integration_util.IntegrationInstance):
class StoreByIdIntegrationInstance(integration_util.IntegrationInstance):
framework_tool_and_types = True

@classmethod
Expand All @@ -32,7 +32,7 @@ def handle_galaxy_config_kwds(cls, config):
config["outputs_to_working_directory"] = True


instance = integration_util.integration_module_instance(StoreByIdTestCase)
instance = integration_util.integration_module_instance(StoreByIdIntegrationInstance)

test_tools = integration_util.integration_tool_runner(
[
Expand Down
4 changes: 2 additions & 2 deletions test/integration/test_upload_configuration_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
TEST_DATA_DIRECTORY = os.path.join(SCRIPT_DIR, os.pardir, os.pardir, "test-data")


class BaseUploadContentConfigurationInstance(integration_util.IntegrationInstance):
class BaseUploadContentConfigurationIntegrationInstance(integration_util.IntegrationInstance):
dataset_populator: DatasetPopulator
framework_tool_and_types = True

Expand Down Expand Up @@ -91,7 +91,7 @@ def _ensure_directory(path: str) -> None:
os.makedirs(path)


class BaseUploadContentConfigurationTestCase(BaseUploadContentConfigurationInstance, TestCase):
class BaseUploadContentConfigurationTestCase(BaseUploadContentConfigurationIntegrationInstance, TestCase):
pass


Expand Down

0 comments on commit 6ffdf84

Please sign in to comment.