Skip to content

Commit

Permalink
add more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Aug 7, 2024
1 parent 8c42119 commit 724e277
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 38 deletions.
8 changes: 2 additions & 6 deletions bert_e/jobs/delete_queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ def delete_queues(job: DeleteQueuesJob):

if not queue_branches:
raise exceptions.JobSuccess()

branch_factory(
repo,
'development/{}.{}'.format(queue_branches[0].major,
queue_branches[0].minor)
).checkout()
# Checkout latest development to delete queue branches.
queue_branches[0].dst_branch.checkout()

for branch in queue_branches:
branch.remove(do_push=False)
Expand Down
74 changes: 42 additions & 32 deletions bert_e/tests/test_bert_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -3721,15 +3721,19 @@ def test_success_message_content(self):
'bypass_build_status',
'bypass_leader_approval',
'bypass_peer_approval',
'bypass_author_approval'],
'bypass_author_approval',
'bypass_jira_check'],
backtrace=True)
except exns.SuccessMessage as e:
self.assertIn('* :heavy_check_mark: `stabilization/5.1.4`', e.msg)
self.assertIn('* :heavy_check_mark: `development/5.1`', e.msg)
self.assertIn('* :heavy_check_mark: `development/5`', e.msg)
self.assertIn('* :heavy_check_mark: `development/10.0`', e.msg)
self.assertIn('* :heavy_check_mark: `development/10`', e.msg)
self.assertIn('* `stabilization/4.3.18`', e.msg)
self.assertIn('* `stabilization/10.0.0`', e.msg)
self.assertIn('* `development/4.3`', e.msg)
self.assertIn('* `development/4`', e.msg)

def test_unanimity_option(self):
"""Test unanimity by passing option to bert-e"""
Expand Down Expand Up @@ -4404,14 +4408,14 @@ def test_stabilization_and_dev_branch_addition(self):

self.gitrepo.cmd('git fetch --prune')
self.gitrepo.cmd('git checkout -B development/5.1'
' origin/development/4.3')
' origin/development/4')
self.gitrepo.cmd('git checkout -B stabilization/5.1.4'
' development/5.1')
self.gitrepo.cmd('git push -u origin '
'development/5.1 stabilization/5.1.4')

if not self.args.disable_queues:
self.gitrepo.cmd('git push origin :q/4.3 :q/10.0')
self.gitrepo.cmd('git push origin :q/4.3 :q/4 :q/10 :q/10.0')

with self.assertRaises(exns.BranchHistoryMismatch):
self.handle(pr.id, options=self.bypass_all, backtrace=True)
Expand Down Expand Up @@ -6892,7 +6896,7 @@ def test_job_create_branch_dev_end(self):
self.gitrepo._get_remote_branches(force=True)
self.assertEqual(
self.gitrepo._remote_branches['development/11.3'],
self.gitrepo._remote_branches['development/10.0']
self.gitrepo._remote_branches['development/10']
)

# consume the 3 expected pr jobs sitting in the job queue
Expand All @@ -6918,23 +6922,35 @@ def test_job_create_branch_dev_end(self):
'q/10.0',
'q/11.3',
'q/1/4.3/feature/TEST-01',
'q/1/4/feature/TEST-01',
'q/1/5.1/feature/TEST-01',
'q/1/5/feature/TEST-01',
'q/1/10.0/feature/TEST-01',
'q/1/10/feature/TEST-01',
'q/1/11.3/feature/TEST-01',
'q/2/4.3/feature/TEST-02',
'q/2/4/feature/TEST-02',
'q/2/5.1/feature/TEST-02',
'q/2/5/feature/TEST-02',
'q/2/10.0/feature/TEST-02',
'q/2/10/feature/TEST-02',
'q/2/11.3/feature/TEST-02',
'q/3/4.3/feature/TEST-03',
'q/3/4/feature/TEST-03',
'q/3/5.1/feature/TEST-03',
'q/3/5/feature/TEST-03',
'q/3/10.0/feature/TEST-03',
'q/3/10/feature/TEST-03',
'q/3/11.3/feature/TEST-03',
'q/13/11.3/feature/TEST-9997',
'q/14/4.3.18/feature/TEST-9998',
'q/14/4.3/feature/TEST-9998',
'q/14/5.1/feature/TEST-9998',
'q/14/10.0/feature/TEST-9998',
'q/14/11.3/feature/TEST-9998',
'q/22/11.3/feature/TEST-9997',
'q/23/4.3.18/feature/TEST-9998',
'q/23/4.3/feature/TEST-9998',
'q/23/4/feature/TEST-9998',
'q/23/5.1/feature/TEST-9998',
'q/23/5/feature/TEST-9998',
'q/23/10.0/feature/TEST-9998',
'q/23/10/feature/TEST-9998',
'q/23/11.3/feature/TEST-9998',
]
self.gitrepo._get_remote_branches(force=True)
for branch in expected_branches:
Expand All @@ -6943,7 +6959,7 @@ def test_job_create_branch_dev_end(self):

# merge everything so that branches advance
# and also to allow creation of intermediary dest branches
sha1_middle = self.gitrepo._remote_branches['q/11.3']
sha1_middle = self.gitrepo._remote_branches['q/10']
self.process_job(ForceMergeQueuesJob(bert_e=self.berte), 'Merged')

# test a branch creation with source specified
Expand All @@ -6958,7 +6974,7 @@ def test_job_create_branch_dev_end(self):
CreateBranchJob(
settings={
'branch': 'development/10.2',
'branch_from': 'development/11.3'},
'branch_from': 'development/10'},
bert_e=self.berte),
'JobSuccess')

Expand All @@ -6970,7 +6986,7 @@ def test_job_create_branch_dev_end(self):
)
self.assertEqual(
self.gitrepo._remote_branches['development/10.2'],
self.gitrepo._remote_branches['development/11.3']
self.gitrepo._remote_branches['development/10']
)

# one last PR to check the repo is in order
Expand Down Expand Up @@ -7147,13 +7163,16 @@ def test_job_create_branch_stab(self):
'development/10.0',
'q/4.3.18',
'q/4.3',
'q/5.1',
'q/4',
'q/5.1.4',
'q/5.1',
'q/5',
'q/10.0',
'q/16/4.3.18/feature/TEST-9999',
'q/16/4.3/feature/TEST-9999',
'q/16/5.1/feature/TEST-9999',
'q/16/10.0/feature/TEST-9999',
'q/10',
'q/30/4.3.18/feature/TEST-9999',
'q/30/4.3/feature/TEST-9999',
'q/30/5.1/feature/TEST-9999',
'q/30/10.0/feature/TEST-9999',
]
self.gitrepo._get_remote_branches(force=True)
for branch in expected_branches:
Expand Down Expand Up @@ -7255,7 +7274,7 @@ def test_job_force_merge_queues(self):
self.assertEqual(sha1_q_10_0, sha1_dev_10_0)

def test_job_force_merge_queues_with_hotfix(self):
self.init_berte(options=self.bypass_all)
self.init_berte(options=self.bypass_all, skip_queue_when_not_needed=True)

# When queues are disabled, Bert-E should respond with 'NotMyJob'
self.process_job(
Expand All @@ -7277,7 +7296,7 @@ def test_job_force_merge_queues_with_hotfix(self):
prs.append(self.create_pr('feature/TEST-666', 'hotfix/4.2.17'))

for pr in prs:
self.process_pr_job(pr, 'Queued')
self.process_pr_job(pr)

# put a mix of build statuses in the queue
self.gitrepo._get_remote_branches()
Expand Down Expand Up @@ -7350,7 +7369,7 @@ def test_job_delete_queues(self):
self.assertTrue(self.berte.task_queue.empty())

def test_job_delete_queues_with_hotfix(self):
self.init_berte(options=self.bypass_all)
self.init_berte(options=self.bypass_all, skip_queue_when_not_needed=True)

# When queues are disabled, Bert-E should respond with 'NotMyJob'
self.process_job(
Expand All @@ -7371,23 +7390,14 @@ def test_job_delete_queues_with_hotfix(self):
prs.append(self.create_pr('feature/TEST-666', 'hotfix/4.2.17'))

for pr in prs:
self.process_pr_job(pr, 'Queued')
self.process_pr_job(pr)

expected_branches = [
'q/4.2.17.1',
'q/4.3',
'q/5.1',
'q/10.0',
'q/1/4.3/feature/TEST-01',
'q/1/5.1/feature/TEST-01',
'q/1/10.0/feature/TEST-01',
'q/2/4.3/feature/TEST-02',
'q/2/5.1/feature/TEST-02',
'q/2/10.0/feature/TEST-02',
'q/3/4.3/feature/TEST-03',
'q/3/5.1/feature/TEST-03',
'q/3/10.0/feature/TEST-03',
'q/4/4.2.17.1/feature/TEST-666',

]
# Check that all PRs are queued

Expand Down

0 comments on commit 724e277

Please sign in to comment.