mirror of
https://github.com/fatedier/frp.git
synced 2025-07-27 07:35:07 +00:00
more e2e tests (#1845)
This commit is contained in:
76
test/e2e/plugin/client_plugins.go
Normal file
76
test/e2e/plugin/client_plugins.go
Normal file
@@ -0,0 +1,76 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/fatedier/frp/test/e2e/framework"
|
||||
"github.com/fatedier/frp/test/e2e/framework/consts"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var connTimeout = 2 * time.Second
|
||||
|
||||
var _ = Describe("[Feature: Client-Plugins]", func() {
|
||||
f := framework.NewDefaultFramework()
|
||||
|
||||
Describe("UnixDomainSocket", func() {
|
||||
It("Expose a unix domain socket echo server", func() {
|
||||
serverConf := consts.DefaultServerConfig
|
||||
clientConf := consts.DefaultClientConfig
|
||||
|
||||
getProxyConf := func(proxyName string, portName string, extra string) string {
|
||||
return fmt.Sprintf(`
|
||||
[%s]
|
||||
type = tcp
|
||||
remote_port = {{ .%s }}
|
||||
plugin = unix_domain_socket
|
||||
plugin_unix_path = {{ .%s }}
|
||||
`+extra, proxyName, portName, framework.UDSEchoServerAddr)
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
proxyName string
|
||||
portName string
|
||||
extraConfig string
|
||||
}{
|
||||
{
|
||||
proxyName: "normal",
|
||||
portName: framework.GenPortName("Normal"),
|
||||
},
|
||||
{
|
||||
proxyName: "with-encryption",
|
||||
portName: framework.GenPortName("WithEncryption"),
|
||||
extraConfig: "use_encryption = true",
|
||||
},
|
||||
{
|
||||
proxyName: "with-compression",
|
||||
portName: framework.GenPortName("WithCompression"),
|
||||
extraConfig: "use_compression = true",
|
||||
},
|
||||
{
|
||||
proxyName: "with-encryption-and-compression",
|
||||
portName: framework.GenPortName("WithEncryptionAndCompression"),
|
||||
extraConfig: `
|
||||
use_encryption = true
|
||||
use_compression = true
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
// build all client config
|
||||
for _, test := range tests {
|
||||
clientConf += getProxyConf(test.proxyName, test.portName, test.extraConfig) + "\n"
|
||||
}
|
||||
// run frps and frpc
|
||||
f.RunProcesses([]string{serverConf}, []string{clientConf})
|
||||
|
||||
for _, test := range tests {
|
||||
framework.ExpectTCPRequest(f.UsedPorts[test.portName],
|
||||
[]byte(consts.TestString), []byte(consts.TestString),
|
||||
connTimeout, test.proxyName)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user