mirror of
https://github.com/fatedier/frp.git
synced 2026-03-21 08:23:29 +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:
@@ -30,7 +30,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
path = "%s/store.json"
|
||||
`, adminPort, f.TempDirectory)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
proxyConfig := map[string]any{
|
||||
@@ -71,7 +71,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
path = "%s/store.json"
|
||||
`, adminPort, f.TempDirectory)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
proxyConfig := map[string]any{
|
||||
@@ -125,7 +125,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
path = "%s/store.json"
|
||||
`, adminPort, f.TempDirectory)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
proxyConfig := map[string]any{
|
||||
@@ -173,7 +173,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
path = "%s/store.json"
|
||||
`, adminPort, f.TempDirectory)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
proxyConfig := map[string]any{
|
||||
@@ -225,7 +225,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
webServer.port = %d
|
||||
`, adminPort)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
framework.NewRequestExpect(f).RequestModify(func(r *request.Request) {
|
||||
@@ -247,7 +247,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
path = "%s/store.json"
|
||||
`, adminPort, f.TempDirectory)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
invalidBody, _ := json.Marshal(map[string]any{
|
||||
@@ -280,7 +280,7 @@ var _ = ginkgo.Describe("[Feature: Store]", func() {
|
||||
path = "%s/store.json"
|
||||
`, adminPort, f.TempDirectory)
|
||||
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
f.RunProcesses(serverConf, []string{clientConf})
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
createBody, _ := json.Marshal(map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user