Browse Source

Fix test_crd_check_unknown tests

These tests have a race where we rely on input events for unknown
projects in gerrit/github to populate our fake change and project
databases for those event sources. Before our dependent change is able
to be processed we need the parent change's event to be fully processed
and populate the database.

Without this we get database lookup errors which leads to us never
running jobs for the dependent change. When that happens we are unable
to properly assert the test conditions that the dependent change is
tested without the parent change.

Fix this by adding the parent change events, waiting for things to
settle, then adding the child change events.

Change-Id: I0641c44051d760c7be0f408f6b9b59222b8d4e90
changes/91/724191/1
Clark Boylan 1 year ago
parent
commit
6ef4f078aa
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      tests/unit/test_cross_crd.py

+ 8
- 1
tests/unit/test_cross_crd.py View File

@ -438,8 +438,12 @@ class TestGerritToGithubCRD(ZuulTestCase):
A.data['commitMessage'] = '%s\n\nDepends-On: %s\n' % (
A.subject, B.url)
# Make sure zuul has seen an event on B.
# Make sure zuul has seen an event on B. This is necessary
# in order to populate our fake github project db.
self.fake_github.emitEvent(B.getPullRequestEditedEvent())
# Note we wait until settled here as the event processing for
# the next event may not have the updated db yet otherwise.
self.waitUntilSettled()
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
@ -900,6 +904,9 @@ class TestGithubToGerritCRD(ZuulTestCase):
# Make sure zuul has seen an event on B.
self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
# Note we wait until settled here as the event processing for
# the next event may not have the updated db yet otherwise.
self.waitUntilSettled()
self.fake_github.emitEvent(A.getPullRequestEditedEvent())
self.waitUntilSettled()


Loading…
Cancel
Save