mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
add e2e tests (#2334)
This commit is contained in:
@@ -132,13 +132,6 @@ custom_domains = test6.frp.com
|
||||
host_header_rewrite = test6.frp.com
|
||||
header_X-From-Where = frp
|
||||
|
||||
[tcpmuxhttpconnect]
|
||||
type = tcpmux
|
||||
multiplexer = httpconnect
|
||||
local_ip = 127.0.0.1
|
||||
local_port = 10701
|
||||
custom_domains = tunnel1
|
||||
|
||||
[wildcard_http]
|
||||
type = http
|
||||
local_ip = 127.0.0.1
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -13,7 +12,6 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/fatedier/frp/client/proxy"
|
||||
"github.com/fatedier/frp/server/ports"
|
||||
"github.com/fatedier/frp/tests/consts"
|
||||
"github.com/fatedier/frp/tests/mock"
|
||||
"github.com/fatedier/frp/tests/util"
|
||||
@@ -155,17 +153,6 @@ func TestHTTP(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTCPMux(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
conn, err := gnet.DialTcpByProxy(fmt.Sprintf("http://%s:%d", "127.0.0.1", consts.TEST_TCP_MUX_FRP_PORT), "tunnel1")
|
||||
if assert.NoError(err) {
|
||||
res, err := util.SendTCPMsgByConn(conn, consts.TEST_TCP_ECHO_STR)
|
||||
assert.NoError(err)
|
||||
assert.Equal(consts.TEST_TCP_ECHO_STR, res)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebSocket(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
@@ -182,39 +169,6 @@ func TestWebSocket(t *testing.T) {
|
||||
assert.Equal(consts.TEST_HTTP_NORMAL_STR, string(msg))
|
||||
}
|
||||
|
||||
func TestAllowPorts(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// Port not allowed
|
||||
status, err := util.GetProxyStatus(consts.ADMIN_ADDR, consts.ADMIN_USER, consts.ADMIN_PWD, consts.ProxyTCPPortNotAllowed)
|
||||
if assert.NoError(err) {
|
||||
assert.Equal(proxy.ProxyPhaseStartErr, status.Status)
|
||||
assert.True(strings.Contains(status.Err, ports.ErrPortNotAllowed.Error()))
|
||||
}
|
||||
|
||||
status, err = util.GetProxyStatus(consts.ADMIN_ADDR, consts.ADMIN_USER, consts.ADMIN_PWD, consts.ProxyUDPPortNotAllowed)
|
||||
if assert.NoError(err) {
|
||||
assert.Equal(proxy.ProxyPhaseStartErr, status.Status)
|
||||
assert.True(strings.Contains(status.Err, ports.ErrPortNotAllowed.Error()))
|
||||
}
|
||||
|
||||
status, err = util.GetProxyStatus(consts.ADMIN_ADDR, consts.ADMIN_USER, consts.ADMIN_PWD, consts.ProxyTCPPortUnavailable)
|
||||
if assert.NoError(err) {
|
||||
assert.Equal(proxy.ProxyPhaseStartErr, status.Status)
|
||||
assert.True(strings.Contains(status.Err, ports.ErrPortUnAvailable.Error()))
|
||||
}
|
||||
|
||||
// Port normal
|
||||
status, err = util.GetProxyStatus(consts.ADMIN_ADDR, consts.ADMIN_USER, consts.ADMIN_PWD, consts.ProxyTCPPortNormal)
|
||||
if assert.NoError(err) {
|
||||
assert.Equal(proxy.ProxyPhaseRunning, status.Status)
|
||||
}
|
||||
|
||||
status, err = util.GetProxyStatus(consts.ADMIN_ADDR, consts.ADMIN_USER, consts.ADMIN_PWD, consts.ProxyUDPPortNormal)
|
||||
if assert.NoError(err) {
|
||||
assert.Equal(proxy.ProxyPhaseRunning, status.Status)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRandomPort(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// tcp
|
||||
|
||||
Reference in New Issue
Block a user