From 021cb80abdf68ae3f2184a6b8addf043767cb018 Mon Sep 17 00:00:00 2001 From: John Davis Date: Fri, 1 Mar 2024 17:22:34 -0500 Subject: [PATCH 1/3] Fix bug: this is not part of a sql stmt --- lib/galaxy/model/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index c19ec9770bcf..5b06b08cb74c 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -919,7 +919,7 @@ def adjust_total_disk_usage(self, amount, quota_source_label): assert amount is not None if amount != 0: if quota_source_label is None: - self.disk_usage = func.coalesce(self.table.c.disk_usage, 0) + amount + self.disk_usage = (self.disk_usage or 0) + amount else: # else would work on newer sqlite - 3.24.0 engine = object_session(self).bind From 031a8599aece2b1fbb7b2e573014e0364f5e76fe Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Mon, 4 Mar 2024 14:39:55 +0000 Subject: [PATCH 2/3] Fix ``test_page_encoding`` test Don't assume that the history has unencoded id 1. Broken by commit 85630e2ca90211bfaea459192a90b7070c0a024a . Fix the following error: ``` ______________ TestPageJsonEncodingIntegration.test_page_encoding ______________ self = history_id = '529fd61ab1c6cc36' def test_page_encoding(self, history_id: str): request = dict( slug="mypage", title="MY PAGE", content=f"""

Page!

""", ) page_response = self._post("pages", request, json=True) api_asserts.assert_status_code_is_ok(page_response) sa_session = self._app.model.session page_revision = sa_session.scalars(select(model.PageRevision).filter_by(content_format="html")).all()[0] > assert '''id="History-1"''' in page_revision.content, page_revision.content E AssertionError:

Page!

Embedded Galaxy History - 'test_history'

[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]

E assert 'id="History-1"' in '

Page!

Embedded Galaxy History - \'test_history\'

[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]

' E + where '

Page!

Embedded Galaxy History - \'test_history\'

[Do not edit this block; Galaxy will fill it in with the annotated History when it is displayed]

' = .content test/integration/test_page_revision_json_encoding.py:33: AssertionError ``` --- test/integration/test_page_revision_json_encoding.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/integration/test_page_revision_json_encoding.py b/test/integration/test_page_revision_json_encoding.py index 1e197b30d883..f112b282ae2e 100644 --- a/test/integration/test_page_revision_json_encoding.py +++ b/test/integration/test_page_revision_json_encoding.py @@ -5,6 +5,8 @@ exported API values are encoded though. """ +import re + from sqlalchemy import select from galaxy import model @@ -21,6 +23,7 @@ def setUp(self): self.dataset_populator = DatasetPopulator(self.galaxy_interactor) def test_page_encoding(self, history_id: str): + history_num_re = re.compile(r'id="History-\d+"') request = dict( slug="mypage", title="MY PAGE", @@ -30,13 +33,13 @@ def test_page_encoding(self, history_id: str): api_asserts.assert_status_code_is_ok(page_response) sa_session = self._app.model.session page_revision = sa_session.scalars(select(model.PageRevision).filter_by(content_format="html")).all()[0] - assert '''id="History-1"''' in page_revision.content, page_revision.content + assert history_num_re.search(page_revision.content), page_revision.content assert f'''id="History-{history_id}"''' not in page_revision.content, page_revision.content show_page_response = self._get("pages/{}".format(page_response.json()["id"])) api_asserts.assert_status_code_is_ok(show_page_response) content = show_page_response.json()["content"] - assert '''id="History-1"''' not in content, content + assert not history_num_re.search(content), content assert f'''id="History-{history_id}"''' in content, content def test_page_encoding_markdown(self, history_id: str): From 241fc3b79be96ff0d4df96dad03f9d66c4f25787 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Mon, 4 Mar 2024 15:46:23 +0000 Subject: [PATCH 3/3] Fix test_collection_explicit_and_implicit test which was working only because `workflow_id` and `history_id` were the same before commit 85630e2ca90211bfaea459192a90b7070c0a024a . --- test/integration/test_workflow_scheduling_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/test_workflow_scheduling_options.py b/test/integration/test_workflow_scheduling_options.py index cdea882fd79d..95800a05932a 100644 --- a/test/integration/test_workflow_scheduling_options.py +++ b/test/integration/test_workflow_scheduling_options.py @@ -90,7 +90,7 @@ def test_collection_explicit_and_implicit(self): inputs = { "0": {"src": "hdca", "id": hdca1["id"]}, } - self.workflow_populator.invoke_workflow_and_wait(history_id, workflow_id, inputs) + self.workflow_populator.invoke_workflow_and_wait(workflow_id, history_id, inputs) self.dataset_populator.wait_for_history(history_id, assert_ok=True) assert "a\nc\nb\nd\ne\ng\nf\nh\n" == self.dataset_populator.get_history_dataset_content(history_id, hid=0)