From d86bfad8cd8a3204bf3e09b6de287d0160357025 Mon Sep 17 00:00:00 2001 From: Thomas Carmet <8408330+tcarmet@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:57:27 +0000 Subject: [PATCH] start breaking stuff --- bert_e/server/status.py | 1 + bert_e/tests/test_bert_e.py | 9 +++++++++ bert_e/tests/unit/test_sorted.py | 4 ++-- bert_e/workflow/gitwaterflow/branches.py | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bert_e/server/status.py b/bert_e/server/status.py index d4d11a72..5d81e93f 100644 --- a/bert_e/server/status.py +++ b/bert_e/server/status.py @@ -44,6 +44,7 @@ def display(): for version, _ in queued_commits: versions.add(version) + # TODO: check the display of the queue versions = sorted(versions, reverse=True) for pr_id, queued_commits in queue_data.items(): diff --git a/bert_e/tests/test_bert_e.py b/bert_e/tests/test_bert_e.py index 26721d4a..ad823415 100644 --- a/bert_e/tests/test_bert_e.py +++ b/bert_e/tests/test_bert_e.py @@ -121,6 +121,8 @@ def initialize_git_repo(repo, username, usermail): create_branch(repo, 'development/' + major_minor, 'stabilization/' + full_version, file_=True, do_push=False) + create_branch(repo, f'development/{major}', f'development/{major_minor}', + file_=True, do_push=False) if major != 6 and major != 10: repo.cmd('git tag %s.%s.%s', major, minor, micro - 1) @@ -4800,6 +4802,13 @@ def test_set_bot_status(self): pr.src_commit, key="bert-e") == "queued" self.handle(pr.id, settings=settings, options=self.bypass_all) + def test_dev_major_only(self): + """Test Bert-E's capability to handle a gitwaterflow with a development/x branch.""" + # create a development/4 branch + pr = self.create_pr('bugfix/TEST-01', 'development/4.3') + self.handle(pr.id, options=self.bypass_all) + pr = self.create_pr('bugfix/TEST-02', 'stabilization/4.3.18') + self.handle(pr.id, options=self.bypass_all) class TestQueueing(RepositoryTests): """Tests which validate all things related to the merge queue. diff --git a/bert_e/tests/unit/test_sorted.py b/bert_e/tests/unit/test_sorted.py index ee985d2e..6b424681 100644 --- a/bert_e/tests/unit/test_sorted.py +++ b/bert_e/tests/unit/test_sorted.py @@ -11,7 +11,7 @@ def test_sorted_with_branches(): StabilizationBranch: None, HotfixBranch: None, } - branches[1, -1] = { + branches[1, None] = { DevelopmentBranch: None, StabilizationBranch: None, HotfixBranch: None, @@ -28,4 +28,4 @@ def test_sorted_with_branches(): } sorted_branches = OrderedDict(sorted(branches.items(), key=cmp_to_key(compare_branches))) - assert list(sorted_branches.keys()) == [(1, 0), (1, 1), (1, -1), (2, 0)] + assert list(sorted_branches.keys()) == [(1, 0), (1, 1), (1, None), (2, 0)] diff --git a/bert_e/workflow/gitwaterflow/branches.py b/bert_e/workflow/gitwaterflow/branches.py index 375cb614..38707685 100644 --- a/bert_e/workflow/gitwaterflow/branches.py +++ b/bert_e/workflow/gitwaterflow/branches.py @@ -1010,6 +1010,7 @@ def _set_target_versions(self, dst_branch): elif dev_branch and dev_branch.has_minor is False: latest_minor = self._find_latest_minor(major) minor = latest_minor + 1 if latest_minor is not None else 0 + # TODO: handle case with stab/x.y.z with no dev/x.y self.target_versions.append(f"{major}.{minor}.{dev_branch.micro + 1}")