From adbdb4bb60b2aea6122d7d2137435878e52cf45b Mon Sep 17 00:00:00 2001
From: Arturo Borrero Gonzalez <aborrero@wikimedia.org>
Date: Fri, 7 Jun 2024 11:21:47 +0200
Subject: [PATCH] functional-tests: build-smoke-test: retry build show test

I have detected in my laptop that even if the build was OK, the
Status field wont be update by the time this test is run.

Retry a few times.

Signed-off-by: Arturo Borrero Gonzalez <aborrero@wikimedia.org>
---
 functional-tests/builds-api/build-smoke-test.bats | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/functional-tests/builds-api/build-smoke-test.bats b/functional-tests/builds-api/build-smoke-test.bats
index 1ef8cb1f..4cca68d0 100755
--- a/functional-tests/builds-api/build-smoke-test.bats
+++ b/functional-tests/builds-api/build-smoke-test.bats
@@ -31,15 +31,15 @@ setup_file() {
 
 # bats test_tags=slow
 @test "tail logs and wait (slow)" {
-    # this also waits for it to finish
     toolforge build logs -f
 }
 
 
 # bats test_tags=slow
-@test "show finished build" {
-    run toolforge build show
-    assert_line --partial "Status: ok"
+@test "show finished build (slow)" {
+    # the build may download a bunch of stuff from the internet
+    # retry in case the build takes time to complete and update the Status field
+    retry "toolforge build show | grep 'Status: ok'"
 }
 
 
-- 
GitLab