mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 03:48:37 +08:00
fix: [skip e2e] Dedup available ports and retry for integration setup (#31902)
See also #31901 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
019d76c79d
commit
1c2ae59ece
@ -51,6 +51,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus/pkg/log"
|
"github.com/milvus-io/milvus/pkg/log"
|
||||||
"github.com/milvus-io/milvus/pkg/util/etcd"
|
"github.com/milvus-io/milvus/pkg/util/etcd"
|
||||||
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
||||||
|
"github.com/milvus-io/milvus/pkg/util/typeutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var params *paramtable.ComponentParam = paramtable.Get()
|
var params *paramtable.ComponentParam = paramtable.Get()
|
||||||
@ -427,15 +428,15 @@ func (cluster *MiniClusterV2) GetFactory() dependency.Factory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cluster *MiniClusterV2) GetAvailablePorts(n int) ([]int, error) {
|
func (cluster *MiniClusterV2) GetAvailablePorts(n int) ([]int, error) {
|
||||||
ports := make([]int, n)
|
ports := typeutil.NewSet[int]()
|
||||||
for i := range ports {
|
for ports.Len() < n {
|
||||||
port, err := cluster.GetAvailablePort()
|
port, err := cluster.GetAvailablePort()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ports[i] = port
|
ports.Insert(port)
|
||||||
}
|
}
|
||||||
return ports, nil
|
return ports.Collect(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cluster *MiniClusterV2) GetAvailablePort() (int, error) {
|
func (cluster *MiniClusterV2) GetAvailablePort() (int, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user