mirror of
https://github.com/fatedier/frp.git
synced 2026-03-11 04:19:10 +08:00
Replace the fixed 500ms sleep after each frps startup in RunProcesses with a TCP dial-based readiness check that polls the server bind port. This reduces the e2e suite wall time from ~97s to ~43s. Also simplify the RunProcesses API to accept a single server template string instead of a slice, matching how every call site uses it.
35 lines
752 B
Go
35 lines
752 B
Go
package e2e
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/onsi/ginkgo/v2"
|
|
|
|
"github.com/fatedier/frp/test/e2e/framework"
|
|
"github.com/fatedier/frp/test/e2e/framework/consts"
|
|
)
|
|
|
|
var _ = ginkgo.Describe("[Feature: Example]", func() {
|
|
f := framework.NewDefaultFramework()
|
|
|
|
ginkgo.Describe("TCP", func() {
|
|
ginkgo.It("Expose a TCP echo server", func() {
|
|
serverConf := consts.DefaultServerConfig
|
|
clientConf := consts.DefaultClientConfig
|
|
|
|
remotePort := f.AllocPort()
|
|
clientConf += fmt.Sprintf(`
|
|
[[proxies]]
|
|
name = "tcp"
|
|
type = "tcp"
|
|
localPort = {{ .%s }}
|
|
remotePort = %d
|
|
`, framework.TCPEchoServerPort, remotePort)
|
|
|
|
f.RunProcesses(serverConf, []string{clientConf})
|
|
|
|
framework.NewRequestExpect(f).Port(remotePort).Ensure()
|
|
})
|
|
})
|
|
})
|