heartbeat.go 1.0 KB

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