Skip to content

Commit

Permalink
Merge pull request galaxyproject#16493 from mvdbeek/update_cache_tests
Browse files Browse the repository at this point in the history
Test that object store cache file gets updated
  • Loading branch information
jmchilton authored Jul 31, 2023
2 parents 7763258 + b38941b commit ee8b2a9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions test/integration/objectstore/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ def setUp(self):
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)


def get_files(directory):
for rel_directory, _, files in os.walk(directory):
for file_ in files:
yield os.path.join(rel_directory, file_)


def files_count(directory):
return sum(len(files) for _, _, files in os.walk(directory))
return sum(1 for _ in get_files(directory))


@integration_util.skip_unless_docker()
Expand All @@ -85,7 +91,7 @@ def handle_galaxy_config_kwds(cls, config):
config_path = os.path.join(temp_directory, "object_store_conf.xml")
config["object_store_store_by"] = "uuid"
config["metadata_strategy"] = "extended"
config["outpus_to_working_dir"] = True
config["outputs_to_working_directory"] = True
config["retry_metadata_internally"] = False
with open(config_path, "w") as f:
f.write(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def handle_galaxy_config_kwds(cls, config):
cls.object_stores_parent = temp_directory
cls.object_store_config_path = os.path.join(temp_directory, "object_store_conf.xml")
config["metadata_strategy"] = "extended"
config["outpus_to_working_dir"] = True
config["outputs_to_working_directory"] = True
config["retry_metadata_internally"] = False
config["object_store_store_by"] = "uuid"
with open(cls.object_store_config_path, "w") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ._base import (
BaseSwiftObjectStoreIntegrationTestCase,
files_count,
get_files,
)


Expand Down Expand Up @@ -71,3 +72,9 @@ def test_delete_item_not_in_cache(self):
hda["history_id"], content_id=hda["id"], wait=False, assert_ok=False
)
assert "File Not Found" in str(excinfo.value)

def test_upload_updates_cache(self):
self.upload_dataset()
assert files_count(self.object_store_cache_path) == 1
only_file = next(iter(get_files(self.object_store_cache_path)))
assert os.path.getsize(only_file) == 4
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@


class ExtendedMetadataOutputsToWorkingDirIntegrationInstance(ExtendedMetadataIntegrationInstance):
"""Describe a Galaxy test instance with metadata_strategy set to extended and outputs_to_working_dir set."""
"""Describe a Galaxy test instance with metadata_strategy set to extended and outputs_to_working_directory set."""

@classmethod
def handle_galaxy_config_kwds(cls, config):
config["metadata_strategy"] = "extended"
config["object_store_store_by"] = "uuid"
config["outpus_to_working_dir"] = True
config["outputs_to_working_directory"] = True
config["retry_metadata_internally"] = False


Expand Down

0 comments on commit ee8b2a9

Please sign in to comment.