2020-06-02 14:48:55 +00:00
|
|
|
package e2e
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2022-08-28 17:02:53 +00:00
|
|
|
"github.com/onsi/ginkgo"
|
|
|
|
|
2020-06-02 14:48:55 +00:00
|
|
|
"github.com/fatedier/frp/test/e2e/framework"
|
|
|
|
"github.com/fatedier/frp/test/e2e/framework/consts"
|
|
|
|
)
|
|
|
|
|
2022-08-28 17:02:53 +00:00
|
|
|
var _ = ginkgo.Describe("[Feature: Example]", func() {
|
2020-06-02 14:48:55 +00:00
|
|
|
f := framework.NewDefaultFramework()
|
|
|
|
|
2022-08-28 17:02:53 +00:00
|
|
|
ginkgo.Describe("TCP", func() {
|
|
|
|
ginkgo.It("Expose a TCP echo server", func() {
|
2020-09-07 06:57:23 +00:00
|
|
|
serverConf := consts.DefaultServerConfig
|
|
|
|
clientConf := consts.DefaultClientConfig
|
2020-06-02 14:48:55 +00:00
|
|
|
|
2021-06-18 08:48:36 +00:00
|
|
|
remotePort := f.AllocPort()
|
2020-09-07 06:57:23 +00:00
|
|
|
clientConf += fmt.Sprintf(`
|
2020-06-02 14:48:55 +00:00
|
|
|
[tcp]
|
|
|
|
type = tcp
|
|
|
|
local_port = {{ .%s }}
|
2021-06-18 08:48:36 +00:00
|
|
|
remote_port = %d
|
|
|
|
`, framework.TCPEchoServerPort, remotePort)
|
2020-06-02 14:48:55 +00:00
|
|
|
|
|
|
|
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
|
|
|
|
2021-06-18 08:48:36 +00:00
|
|
|
framework.NewRequestExpect(f).Port(remotePort).Ensure()
|
2020-06-02 14:48:55 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|