From 4a34ffb997aac5d54cea9aba7ef8dc1ad34288fb Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Fri, 8 Nov 2024 13:55:55 +0100 Subject: [PATCH] TEST: Applying dump upgrade script twice fails. --- dump_updates/test/test_all.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dump_updates/test/test_all.py b/dump_updates/test/test_all.py index 8e97d2a..acdeeec 100644 --- a/dump_updates/test/test_all.py +++ b/dump_updates/test/test_all.py @@ -19,6 +19,11 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. """Testing the dump update scripts + +As a general rule, dump updaters should be idempotent, so tests should run the update again after +the first checks are successlful. + +TODO: Reduce the boilerplate for the tests. """ import filecmp @@ -68,3 +73,13 @@ def test_2024_10_02(tmpdir): check=True ) assert filecmp.cmp(output.name, expectedfile), "Output does not match expected output." + with (NamedTemporaryFile(dir=tmpdir, suffix=".sql", delete=True) as output2, + open(output.name, mode="rb") as infile_stream + ): + run([script_fullname], + stdin=infile_stream, + stdout=output2, + check=True + ) + assert filecmp.cmp(output2.name, expectedfile), ( + "Run 2: Output does not match expected output.") -- GitLab