add e2e tests (#2334)

This commit is contained in:
fatedier
2021-03-31 16:57:39 +08:00
committed by GitHub
parent 9a849a29e9
commit fbaa5f866e
20 changed files with 541 additions and 166 deletions

View File

@@ -2,16 +2,14 @@ package plugin
import (
"fmt"
"time"
"github.com/fatedier/frp/test/e2e/framework"
"github.com/fatedier/frp/test/e2e/framework/consts"
"github.com/fatedier/frp/test/e2e/pkg/port"
. "github.com/onsi/ginkgo"
)
var connTimeout = 2 * time.Second
var _ = Describe("[Feature: Client-Plugins]", func() {
f := framework.NewDefaultFramework()
@@ -37,21 +35,21 @@ var _ = Describe("[Feature: Client-Plugins]", func() {
}{
{
proxyName: "normal",
portName: framework.GenPortName("Normal"),
portName: port.GenName("Normal"),
},
{
proxyName: "with-encryption",
portName: framework.GenPortName("WithEncryption"),
portName: port.GenName("WithEncryption"),
extraConfig: "use_encryption = true",
},
{
proxyName: "with-compression",
portName: framework.GenPortName("WithCompression"),
portName: port.GenName("WithCompression"),
extraConfig: "use_compression = true",
},
{
proxyName: "with-encryption-and-compression",
portName: framework.GenPortName("WithEncryptionAndCompression"),
portName: port.GenName("WithEncryptionAndCompression"),
extraConfig: `
use_encryption = true
use_compression = true
@@ -67,9 +65,11 @@ var _ = Describe("[Feature: Client-Plugins]", func() {
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)
framework.ExpectResponse(
framework.NewRequest().Port(f.PortByName(test.portName)),
[]byte(consts.TestString),
test.proxyName,
)
}
})
})