frp/test/e2e/examples.go

35 lines
774 B
Go
Raw Normal View History

2020-06-02 16:48:55 +02:00
package e2e
import (
"fmt"
"github.com/fatedier/frp/test/e2e/framework"
"github.com/fatedier/frp/test/e2e/framework/consts"
2021-03-31 10:57:39 +02:00
"github.com/fatedier/frp/test/e2e/pkg/port"
2020-06-02 16:48:55 +02:00
. "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 08:57:23 +02:00
serverConf := consts.DefaultServerConfig
clientConf := consts.DefaultClientConfig
2020-06-02 16:48:55 +02:00
2021-03-31 10:57:39 +02:00
portName := port.GenName("TCP")
2020-09-07 08:57:23 +02:00
clientConf += fmt.Sprintf(`
2020-06-02 16:48:55 +02:00
[tcp]
type = tcp
local_port = {{ .%s }}
2020-09-07 08:57:23 +02:00
remote_port = {{ .%s }}
2021-03-31 10:57:39 +02:00
`, framework.TCPEchoServerPort, portName)
2020-06-02 16:48:55 +02:00
f.RunProcesses([]string{serverConf}, []string{clientConf})
2021-03-31 10:57:39 +02:00
framework.NewRequestExpect(f).PortName(portName).Ensure()
2020-06-02 16:48:55 +02:00
})
})
})