| 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 | bindAddr = "0.0.0.0" |
| 19 | bindPort = %d |
| 20 | transport.heartbeatTimeout = -1 |
| 21 | transport.tcpMuxKeepaliveInterval = 2 |
| 22 | `, serverPort) |
| 23 | |
| 24 | remotePort := f.AllocPort() |
| 25 | clientConf := fmt.Sprintf(` |
| 26 | serverPort = %d |
| 27 | log.level = "trace" |
| 28 | transport.heartbeatInterval = -1 |
| 29 | transport.heartbeatTimeout = -1 |
| 30 | transport.tcpMuxKeepaliveInterval = 2 |
| 31 | |
| 32 | [[proxies]] |
| 33 | name = "tcp" |
| 34 | type = "tcp" |
| 35 | localPort = %d |
| 36 | remotePort = %d |
| 37 | `, serverPort, f.PortByName(framework.TCPEchoServerPort), remotePort) |
| 38 | |
| 39 | // run frps and frpc |
| 40 | f.RunProcesses(serverConf, []string{clientConf}) |
| 41 | |
| 42 | framework.NewRequestExpect(f).Protocol("tcp").Port(remotePort).Ensure() |
| 43 | |
| 44 | time.Sleep(5 * time.Second) |
| 45 | framework.NewRequestExpect(f).Protocol("tcp").Port(remotePort).Ensure() |
| 46 | }) |
| 47 | }) |