mirror of https://github.com/milvus-io/milvus.git
fix: wait server to listen the http port (#29075)
issue: #29068 wait server to listen the http port then check whether various urls can be accessed normally Signed-off-by: PowderLi <min.li@zilliz.com>pull/29143/head
parent
49b8657f95
commit
cb5c06c718
|
@ -22,10 +22,12 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -43,6 +45,13 @@ type HTTPServerTestSuite struct {
|
||||||
func (suite *HTTPServerTestSuite) SetupSuite() {
|
func (suite *HTTPServerTestSuite) SetupSuite() {
|
||||||
paramtable.Init()
|
paramtable.Init()
|
||||||
ServeHTTP()
|
ServeHTTP()
|
||||||
|
conn, err := net.DialTimeout("tcp", "localhost:"+DefaultListenPort, time.Second*5)
|
||||||
|
if err != nil {
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
conn, err = net.DialTimeout("tcp", "localhost:"+DefaultListenPort, time.Second*5)
|
||||||
|
}
|
||||||
|
suite.Equal(nil, err)
|
||||||
|
conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *HTTPServerTestSuite) TearDownSuite() {
|
func (suite *HTTPServerTestSuite) TearDownSuite() {
|
||||||
|
|
Loading…
Reference in New Issue