[go: nahoru, domu]

Skip to content

Commit

Permalink
Test case to demonstrate disk usage update for work dir outputs is br…
Browse files Browse the repository at this point in the history
…oken with celery_extended.
  • Loading branch information
jmchilton committed Jun 11, 2022
1 parent 0e850cb commit 55ffaff
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/galaxy_test/api/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ def test_multidata_param(self):
@uses_test_history(require_new=False)
def test_run_cat1(self, history_id):
# Run simple non-upload tool with an input data parameter.
initial_disk_usage = self.dataset_populator.total_disk_usage()
new_dataset = self.dataset_populator.new_dataset(history_id, content="Cat1Test")
inputs = dict(
input1=dataset_to_param(new_dataset),
Expand All @@ -878,6 +879,8 @@ def test_run_cat1(self, history_id):
output1 = outputs[0]
output1_content = self.dataset_populator.get_history_dataset_content(history_id, dataset=output1)
self.assertEqual(output1_content.strip(), "Cat1Test")
final_disk_usage = self.dataset_populator.total_disk_usage()
assert final_disk_usage >= initial_disk_usage + 9 * 2

@skip_without_tool("cat1")
@uses_test_history(require_new=True)
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy_test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,13 @@ def user_private_role_id(self) -> str:
assert "id" in role, role
return role["id"]

def total_disk_usage(self) -> float:
response = self._get("users/current")
response.raise_for_status()
user_object = response.json()
assert "total_disk_usage" in user_object
return user_object["total_disk_usage"]

def create_role(self, user_ids: list, description: Optional[str] = None) -> dict:
payload = {
"name": self.get_random_name(prefix="testpop"),
Expand Down
30 changes: 30 additions & 0 deletions test/integration/test_metadata_strategy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from galaxy_test.base.populators import (
DatasetPopulator,
uses_test_history,
)
from galaxy_test.driver.integration_util import IntegrationTestCase


class TestDiskUsageUpdateDefault(IntegrationTestCase):
framework_tool_and_types = True

def setUp(self):
super().setUp()
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)

@uses_test_history(require_new=False)
def test_run_work_dir_glob(self, history_id):
# Run a tool with a work dir glob and ensure content and disk usage is updated.
self.dataset_populator.new_dataset(history_id, content="fwd1Test", wait=True)
initial_disk_usage = self.dataset_populator.total_disk_usage()
response = self.dataset_populator.run_tool("from_work_dir_glob", {}, history_id, assert_ok=True)
self.dataset_populator.wait_for_job(job_id=response["jobs"][0]["id"])
final_disk_usage = self.dataset_populator.total_disk_usage()
assert final_disk_usage == initial_disk_usage + 3


class TestDiskUsageCeleryExtended(TestDiskUsageUpdateDefault):
@classmethod
def handle_galaxy_config_kwds(cls, config):
super().handle_galaxy_config_kwds(config)
config["metadata_strategy"] = "celery_extended"

0 comments on commit 55ffaff

Please sign in to comment.