Skip to content

Commit

Permalink
refactor ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
fatedier committed Jul 11, 2018
1 parent 42ee536 commit 0d02f29
Show file tree
Hide file tree
Showing 13 changed files with 240 additions and 186 deletions.
20 changes: 7 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,18 @@ frpc:
test: gotest

gotest:
go test -v ./assets/...
go test -v ./client/...
go test -v ./cmd/...
go test -v ./models/...
go test -v ./server/...
go test -v ./utils/...
go test -v --cover ./assets/...
go test -v --cover ./client/...
go test -v --cover ./cmd/...
go test -v --cover ./models/...
go test -v --cover ./server/...
go test -v --cover ./utils/...

ci:
cd ./tests && ./run_test.sh && cd -
go test -v ./tests/...
cd ./tests && ./clean_test.sh && cd -

cic:
cd ./tests && ./clean_test.sh && cd -
go test -count=1 -v ./tests/...

alltest: gotest ci

clean:
rm -f ./bin/frpc
rm -f ./bin/frps
cd ./tests && ./clean_test.sh && cd -
20 changes: 0 additions & 20 deletions tests/clean_test.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[common]
server_addr = 127.0.0.1
server_port = 10700
log_file = ./frpc.log
log_file = console
# debug, info, warn, error
log_level = debug
token = 123456
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[common]
server_addr = 0.0.0.0
server_port = 10700
log_file = ./frpc_visitor.log
log_file = console
# debug, info, warn, error
log_level = debug
token = 123456
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
bind_addr = 0.0.0.0
bind_port = 10700
vhost_http_port = 10804
log_file = ./frps.log
log_file = console
log_level = debug
token = 123456
allow_ports = 10000-20000,20002,30000-50000
Expand Down
9 changes: 9 additions & 0 deletions tests/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package util

import (
"io/ioutil"
)

func GenerateConfigFile(path string, content string) error {
return ioutil.WriteFile(path, []byte(content), 0666)
}
65 changes: 65 additions & 0 deletions tests/consts/consts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package consts

import "path/filepath"

var (
FRPS_BIN_PATH = "../bin/frps"
FRPC_BIN_PATH = "../bin/frpc"

SERVER_ADDR = "127.0.0.1"
ADMIN_ADDR = "127.0.0.1:10600"
ADMIN_USER = "abc"
ADMIN_PWD = "abc"

TEST_STR = "frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."
TEST_TCP_PORT int = 10701
TEST_TCP2_PORT int = 10702
TEST_TCP_FRP_PORT int = 10801
TEST_TCP2_FRP_PORT int = 10802
TEST_TCP_EC_FRP_PORT int = 10901
TEST_TCP_ECHO_STR string = "tcp type:" + TEST_STR

TEST_UDP_PORT int = 10702
TEST_UDP_FRP_PORT int = 10802
TEST_UDP_EC_FRP_PORT int = 10902
TEST_UDP_ECHO_STR string = "udp type:" + TEST_STR

TEST_UNIX_DOMAIN_ADDR string = "/tmp/frp_echo_server.sock"
TEST_UNIX_DOMAIN_FRP_PORT int = 10803
TEST_UNIX_DOMAIN_STR string = "unix domain type:" + TEST_STR

TEST_HTTP_PORT int = 10704
TEST_HTTP_FRP_PORT int = 10804
TEST_HTTP_NORMAL_STR string = "http normal string: " + TEST_STR
TEST_HTTP_FOO_STR string = "http foo string: " + TEST_STR
TEST_HTTP_BAR_STR string = "http bar string: " + TEST_STR

TEST_STCP_FRP_PORT int = 10805
TEST_STCP_EC_FRP_PORT int = 10905
TEST_STCP_ECHO_STR string = "stcp type:" + TEST_STR

ProxyTcpPortNotAllowed string = "tcp_port_not_allowed"
ProxyTcpPortUnavailable string = "tcp_port_unavailable"
ProxyTcpPortNormal string = "tcp_port_normal"
ProxyTcpRandomPort string = "tcp_random_port"
ProxyUdpPortNotAllowed string = "udp_port_not_allowed"
ProxyUdpPortNormal string = "udp_port_normal"
ProxyUdpRandomPort string = "udp_random_port"
ProxyHttpProxy string = "http_proxy"

ProxyRangeTcpPrefix string = "range_tcp"
)

func init() {
if path, err := filepath.Abs(FRPS_BIN_PATH); err != nil {
panic(err)
} else {
FRPS_BIN_PATH = path
}

if path, err := filepath.Abs(FRPC_BIN_PATH); err != nil {
panic(err)
} else {
FRPC_BIN_PATH = path
}
}
Loading

0 comments on commit 0d02f29

Please sign in to comment.