mirror of
https://github.com/fatedier/frp.git
synced 2026-03-20 08:49:16 +08:00
test/e2e: optimize e2e test time by replacing sleeps with TCP readiness checks (#5223)
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.
This commit is contained in:
@@ -35,7 +35,7 @@ var _ = ginkgo.Describe("[Feature: Config]", func() {
|
||||
`, "`", "`", framework.TCPEchoServerPort, portName)
|
||||
|
||||
f.SetEnvs([]string{"FRP_TOKEN=123"})
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
|
||||
framework.NewRequestExpect(f).PortName(portName).Ensure()
|
||||
})
|
||||
@@ -69,7 +69,7 @@ var _ = ginkgo.Describe("[Feature: Config]", func() {
|
||||
escapeTemplate("{{- end }}"),
|
||||
)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
|
||||
client := f.APIClientForFrpc(adminPort)
|
||||
checkProxyFn := func(name string, localPort, remotePort int) {
|
||||
@@ -149,7 +149,7 @@ proxies:
|
||||
remotePort: %d
|
||||
`, port.GenName("Server"), framework.TCPEchoServerPort, remotePort)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
framework.NewRequestExpect(f).Port(remotePort).Ensure()
|
||||
})
|
||||
|
||||
@@ -161,7 +161,7 @@ proxies:
|
||||
"proxies": [{"name": "tcp", "type": "tcp", "localPort": {{ .%s }}, "remotePort": %d}]}`,
|
||||
port.GenName("Server"), framework.TCPEchoServerPort, remotePort)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
framework.NewRequestExpect(f).Port(remotePort).Ensure()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user