File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package common
3
3
import (
4
4
"os"
5
5
"os/exec"
6
- "time"
7
6
8
7
"go.uber.org/zap"
9
8
)
@@ -38,8 +37,5 @@ func InstallAndRunAiApi(logger *zap.Logger, test bool) error {
38
37
RunCommand (cmd , false , logger )
39
38
}
40
39
41
- // kind of mandatory to wait for the aiapi to start
42
- time .Sleep (time .Duration (30 ) * time .Second )
43
-
44
40
return nil
45
41
}
Original file line number Diff line number Diff line change @@ -204,6 +204,19 @@ func RunTests(log *zap.Logger) {
204
204
log .Info ("Parsed test config" )
205
205
gin .SetMode (gin .ReleaseMode )
206
206
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
+
207
220
log .Info ("Installed and ran AI API" )
208
221
startTests (log )
209
222
}
You can’t perform that action at this time.
0 commit comments