Skip to content

Commit b213963

Browse files
committed
api status code 200
1 parent 0d3670a commit b213963

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

packages/common/aiapi.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package common
33
import (
44
"os"
55
"os/exec"
6-
"time"
76

87
"go.uber.org/zap"
98
)
@@ -38,8 +37,5 @@ func InstallAndRunAiApi(logger *zap.Logger, test bool) error {
3837
RunCommand(cmd, false, logger)
3938
}
4039

41-
// kind of mandatory to wait for the aiapi to start
42-
time.Sleep(time.Duration(30) * time.Second)
43-
4440
return nil
4541
}

packages/testbeds/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ func RunTests(log *zap.Logger) {
204204
log.Info("Parsed test config")
205205
gin.SetMode(gin.ReleaseMode)
206206
common.InstallAndRunAiApi(log, false)
207+
208+
// kind of mandatory to wait for the aiapi to start
209+
for {
210+
time.Sleep(time.Duration(1) * time.Second)
211+
aiApiStatus, err := http.Get("http://localhost:80/ping")
212+
if err != nil {
213+
continue
214+
}
215+
if aiApiStatus.StatusCode == 200 {
216+
break
217+
}
218+
}
219+
207220
log.Info("Installed and ran AI API")
208221
startTests(log)
209222
}

0 commit comments

Comments
 (0)