From 44e8108910d79fa504c7b2ecb0d5a488bc213bc2 Mon Sep 17 00:00:00 2001 From: fatedier Date: Mon, 29 Jan 2018 23:13:10 +0800 Subject: [PATCH] ci: add test case for range ports mapping --- tests/conf/auto_test_frpc.ini | 6 ++++++ tests/conf/auto_test_frps.ini | 2 +- tests/func_test.go | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/conf/auto_test_frpc.ini b/tests/conf/auto_test_frpc.ini index 26da4c1..9376990 100644 --- a/tests/conf/auto_test_frpc.ini +++ b/tests/conf/auto_test_frpc.ini @@ -161,3 +161,9 @@ remote_port = 0 type = tcp plugin = http_proxy remote_port = 0 + +[range:range_tcp] +type = tcp +local_ip = 127.0.0.1 +local_port = 30000-30001,30003 +remote_port = 30000-30001,30003 diff --git a/tests/conf/auto_test_frps.ini b/tests/conf/auto_test_frps.ini index 229ffa8..f59b8a3 100644 --- a/tests/conf/auto_test_frps.ini +++ b/tests/conf/auto_test_frps.ini @@ -5,5 +5,5 @@ vhost_http_port = 10804 log_file = ./frps.log log_level = debug privilege_token = 123456 -privilege_allow_ports = 10000-20000,20002,30000-40000 +privilege_allow_ports = 10000-20000,20002,30000-50000 subdomain_host = sub.com diff --git a/tests/func_test.go b/tests/func_test.go index 4e03f2c..4da7416 100644 --- a/tests/func_test.go +++ b/tests/func_test.go @@ -53,8 +53,9 @@ var ( ProxyUdpPortNotAllowed string = "udp_port_not_allowed" ProxyUdpPortNormal string = "udp_port_normal" ProxyUdpRandomPort string = "udp_random_port" + ProxyHttpProxy string = "http_proxy" - ProxyHttpProxy string = "http_proxy" + ProxyRangeTcpPrefix string = "range_tcp" ) func init() { @@ -286,3 +287,15 @@ func TestPluginHttpProxy(t *testing.T) { } } } + +func TestRangePortsMapping(t *testing.T) { + assert := assert.New(t) + + for i := 0; i < 3; i++ { + name := fmt.Sprintf("%s_%d", ProxyRangeTcpPrefix, i) + status, err := getProxyStatus(name) + if assert.NoError(err) { + assert.Equal(client.ProxyStatusRunning, status.Status) + } + } +}