Commit b11bcf8e authored by alexstocks's avatar alexstocks

add test examples

parent 81c7e8fe
......@@ -50,6 +50,8 @@ type (
// Config holds supported types by the multiconfig package
Config struct {
// local
AppName string `default:"echo-client"`
LocalHost string `default:"127.0.0.1"`
// server
......
......@@ -47,6 +47,8 @@ func main() {
initProfiling()
initClient()
gocolor.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
log.Info("%s starts successfull! its version=%s\n", conf.AppName, Version)
go test()
......@@ -168,5 +170,6 @@ func test() {
echo()
}
cost = counter.Count()
log.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
gocolor.Info("after loop %d times, echo cost %d ms", conf.EchoTimes, cost/1e6)
}
......@@ -10,5 +10,5 @@
package main
var (
Version = "0.3.04"
Version = "0.3.07"
)
# toml configure file
# toml中key的首字母可以小写,但是对应的golang中的struct成员首字母必须大写
AppName = "ECHO-CLIENT"
# host
LocalHost = "127.0.0.1"
......@@ -25,7 +27,7 @@ SessionTimeout = "20s"
# client echo request string
EchoString = "Hello, getty!"
# 发送echo请求次数
EchoTimes = 100000
EchoTimes = 10000
# app fail fast
FailFastTimeout = "3s"
......
......@@ -51,6 +51,7 @@ type (
// Config holds supported types by the multiconfig package
Config struct {
// local address
AppName string `default:"echo-server"`
Host string `default:"127.0.0.1"`
Ports []string `default:["10000"]`
ProfilePort int `default:"10086"`
......
......@@ -24,6 +24,7 @@ import (
import (
"github.com/AlexStocks/getty"
"github.com/AlexStocks/gocolor"
log "github.com/AlexStocks/log4go"
)
......@@ -51,6 +52,10 @@ func main() {
initProfiling()
initServer()
gocolor.Info("%s starts successfull! its version=%s, its listen ends=%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports)
log.Info("%s starts successfull! its version=%s, its listen ends=%s:%s\n",
conf.AppName, Version, conf.Host, conf.Ports)
initSignal()
}
......
......@@ -10,5 +10,5 @@
package main
var (
Version = "0.3.04"
Version = "0.3.07"
)
# toml configure file
# toml中key的首字母可以小写,但是对应的golang中的struct成员首字母必须大写
AppName = "ECHO-SERVER"
# Host = "127.0.0.1"
Host = "192.168.35.1"
Ports = ["10000", "20000"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment