frp/test/e2e/examples.go

34 lines
718 B
Go
Raw Normal View History

2020-06-02 22:48:55 +08:00
package e2e
import (
"fmt"
"github.com/fatedier/frp/test/e2e/framework"
"github.com/fatedier/frp/test/e2e/framework/consts"
. "github.com/onsi/ginkgo"
)
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
2021-06-18 16:48:36 +08:00
remotePort := f.AllocPort()
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 }}
2021-06-18 16:48:36 +08:00
remote_port = %d
`, framework.TCPEchoServerPort, remotePort)
2020-06-02 22:48:55 +08:00
f.RunProcesses([]string{serverConf}, []string{clientConf})
2021-06-18 16:48:36 +08:00
framework.NewRequestExpect(f).Port(remotePort).Ensure()
2020-06-02 22:48:55 +08:00
})
})
})