remove the test file which is not useful & update travis fie

This commit is contained in:
unknown 2019-12-02 18:55:38 +08:00
parent 37db3c836b
commit ddc867d3cc
2 changed files with 17 additions and 80 deletions

View File

@ -1,11 +1,23 @@
language:
- go
language: go
go:
- "1.13"
- dev
script:
- go get -v
- go test -v ./...
- go build cmd/nps/nps.go
before_install:
before_deploy:
- GOARCH=amd64 GOOS=linux go build cmd/nps/nps.go
- zip -r server_linux_amd64.zip nps conf web
deploy:
provider: releases
skip_cleanup: true
file:
- server_linux_amd64.zip
on:
tags: true
all_branches: true
go: 1.13

View File

@ -1,75 +0,0 @@
package client
import (
"net"
"sync"
"testing"
"github.com/cnlh/nps/lib/common"
conn2 "github.com/cnlh/nps/lib/conn"
"github.com/cnlh/nps/lib/file"
)
func TestConfig(t *testing.T) {
conn, err := net.Dial("tcp", "127.0.0.1:8284")
if err != nil {
t.Fail()
}
c := conn2.NewConn(conn)
c.SetAlive("tcp")
if _, err := c.Write([]byte(common.Getverifyval("123"))); err != nil {
t.Fail()
}
c.WriteConfig()
config := &file.Config{
U: "1",
P: "2",
Compress: "snappy",
Crypt: true,
CompressEncode: 0,
CompressDecode: 0,
}
host := &file.Host{
Host: "a.o.com",
Target: "127.0.0.1:8080",
HeaderChange: "",
HostChange: "",
Flow: nil,
Client: nil,
Remark: "111",
NowIndex: 0,
TargetArr: nil,
NoStore: false,
RWMutex: sync.RWMutex{},
}
tunnel := &file.Tunnel{
Port: 9001,
Mode: "tcp",
Target: "127.0.0.1:8082",
Remark: "333",
}
var b []byte
if b, err = c.ReadLen(16); err != nil {
t.Fail()
}
if _, err := c.SendConfigInfo(config); err != nil {
t.Fail()
}
if !c.GetAddStatus() {
t.Fail()
}
if _, err := c.SendHostInfo(host); err != nil {
t.Fail()
}
if !c.GetAddStatus() {
t.Fail()
}
if _, err := c.SendTaskInfo(tunnel); err != nil {
t.Fail()
}
if !c.GetAddStatus() {
t.Fail()
}
c.Close()
NewRPClient("127.0.0.1:8284", string(b), "tcp").Start()
}