ci/cd: unit test hangs for a long time intermittently closes #286

Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
Alexei Dodon
2021-11-22 10:12:01 +02:00
committed by Ramkumar Chinchani
parent fff6107310
commit f99fa37623
6 changed files with 112 additions and 495 deletions
+13
View File
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path"
"time"
"github.com/phayes/freeport"
"gopkg.in/resty.v1"
@@ -14,6 +15,7 @@ import (
const (
BaseURL = "http://127.0.0.1:%s"
BaseSecureURL = "https://127.0.0.1:%s"
SleepTime = 100 * time.Millisecond
)
func GetFreePort() string {
@@ -108,3 +110,14 @@ func CopyFiles(sourceDir string, destDir string) error {
return nil
}
func WaitTillServerReady(url string) {
for {
_, err := resty.R().Get(url)
if err == nil {
break
}
time.Sleep(SleepTime)
}
}