frp/test/e2e/examples.go

36 lines
836 B
Go
Raw Normal View History

2020-06-02 22:48:55 +08:00
package e2e
import (
"fmt"
"time"
"github.com/fatedier/frp/test/e2e/framework"
"github.com/fatedier/frp/test/e2e/framework/consts"
. "github.com/onsi/ginkgo"
)
2020-09-07 14:57:23 +08:00
var connTimeout = 2 * time.Second
2020-06-02 22:48:55 +08:00
var _ = Describe("[Feature: Example]", func() {
f := framework.NewDefaultFramework()
Describe("TCP", func() {
It("Expose a TCP echo server", func() {
2020-09-07 14:57:23 +08:00
serverConf := consts.DefaultServerConfig
clientConf := consts.DefaultClientConfig
2020-06-02 22:48:55 +08:00
2020-09-07 14:57:23 +08:00
clientConf += fmt.Sprintf(`
2020-06-02 22:48:55 +08:00
[tcp]
type = tcp
local_port = {{ .%s }}
2020-09-07 14:57:23 +08:00
remote_port = {{ .%s }}
`, framework.TCPEchoServerPort, framework.GenPortName("TCP"))
2020-06-02 22:48:55 +08:00
f.RunProcesses([]string{serverConf}, []string{clientConf})
2020-09-07 14:57:23 +08:00
framework.ExpectTCPRequest(f.UsedPorts[framework.GenPortName("TCP")], []byte(consts.TestString), []byte(consts.TestString), connTimeout)
2020-06-02 22:48:55 +08:00
})
})
})