Skip to content

Commit d8f02d0

Browse files
authored
Deflake test_published_author_fields (#684)
Unfortunately sometimes it takes a while until the author field is avail, so we need to workaround that.
1 parent 6f0af2d commit d8f02d0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/integration/test_job.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,21 @@ def test_v1_job_fallback(self):
440440
self.assertEqual(n_events, n_preview, n_results)
441441

442442
def test_published_author_fields(self):
443+
def has_author():
444+
jobs = self.service.jobs.list(name=self.job.name)
445+
return (
446+
len(jobs) == 1
447+
and jobs[0].state.author is not None
448+
and jobs[0].state.author.name is not None
449+
)
450+
451+
# It takes a while until the author field becomes available after
452+
# creaton of a job, wait until it is available, before running the asserts.
453+
self.assertEventuallyTrue(
454+
has_author,
455+
timeout=5,
456+
)
457+
443458
jobs = self.service.jobs.list(name=self.job.name)
444459
self.assertEqual(len(jobs), 1)
445460
self.assertEqual(jobs[0].state.author.name, self.service.username)

0 commit comments

Comments
 (0)