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