heartbeat.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package features
  2. import (
  3. "fmt"
  4. "time"
  5. "github.com/onsi/ginkgo/v2"
  6. "github.com/fatedier/frp/test/e2e/framework"
  7. )
  8. var _ = ginkgo.Describe("[Feature: Heartbeat]", func() {
  9. f := framework.NewDefaultFramework()
  10. ginkgo.It("disable application layer heartbeat", func() {
  11. serverPort := f.AllocPort()
  12. serverConf := fmt.Sprintf(`
  13. bindAddr = "0.0.0.0"
  14. bindPort = %d
  15. transport.heartbeatTimeout = -1
  16. transport.tcpMuxKeepaliveInterval = 2
  17. `, serverPort)
  18. remotePort := f.AllocPort()
  19. clientConf := fmt.Sprintf(`
  20. serverPort = %d
  21. log.level = "trace"
  22. transport.heartbeatInterval = -1
  23. transport.heartbeatTimeout = -1
  24. transport.tcpMuxKeepaliveInterval = 2
  25. [[proxies]]
  26. name = "tcp"
  27. type = "tcp"
  28. localPort = %d
  29. remotePort = %d
  30. `, serverPort, f.PortByName(framework.TCPEchoServerPort), remotePort)
  31. // run frps and frpc
  32. f.RunProcesses([]string{serverConf}, []string{clientConf})
  33. framework.NewRequestExpect(f).Protocol("tcp").Port(remotePort).Ensure()
  34. time.Sleep(5 * time.Second)
  35. framework.NewRequestExpect(f).Protocol("tcp").Port(remotePort).Ensure()
  36. })
  37. })