mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
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:
committed by
Ramkumar Chinchani
parent
fff6107310
commit
f99fa37623
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user