frp/test/e2e/examples.go

35 lines
762 B
Go
Raw Normal View History

2020-06-02 21:48:55 +07:00
package e2e
import (
"fmt"
2023-02-27 13:44:16 +07:00
"github.com/onsi/ginkgo/v2"
2022-08-29 00:02:53 +07:00
2020-06-02 21:48:55 +07:00
"github.com/fatedier/frp/test/e2e/framework"
"github.com/fatedier/frp/test/e2e/framework/consts"
)
2022-08-29 00:02:53 +07:00
var _ = ginkgo.Describe("[Feature: Example]", func() {
2020-06-02 21:48:55 +07:00
f := framework.NewDefaultFramework()
2022-08-29 00:02:53 +07:00
ginkgo.Describe("TCP", func() {
ginkgo.It("Expose a TCP echo server", func() {
2020-09-07 13:57:23 +07:00
serverConf := consts.DefaultServerConfig
clientConf := consts.DefaultClientConfig
2020-06-02 21:48:55 +07:00
2021-06-18 15:48:36 +07:00
remotePort := f.AllocPort()
2020-09-07 13:57:23 +07:00
clientConf += fmt.Sprintf(`
2023-09-13 15:32:39 +07:00
[[proxies]]
name = "tcp"
type = "tcp"
localPort = {{ .%s }}
remotePort = %d
2021-06-18 15:48:36 +07:00
`, framework.TCPEchoServerPort, remotePort)
2020-06-02 21:48:55 +07:00
f.RunProcesses([]string{serverConf}, []string{clientConf})
2021-06-18 15:48:36 +07:00
framework.NewRequestExpect(f).Port(remotePort).Ensure()
2020-06-02 21:48:55 +07:00
})
})
})