1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-10-14 13:04:11 -04:00

remove dep on assert lib

This commit is contained in:
Darien Raymond
2019-02-02 22:19:30 +01:00
parent 2a0f3591f4
commit bdd71a44b4
35 changed files with 365 additions and 324 deletions

View File

@@ -6,6 +6,7 @@ import (
"v2ray.com/core/app/stats"
. "v2ray.com/core/app/stats/command"
"v2ray.com/core/common"
. "v2ray.com/ext/assert"
)
@@ -13,10 +14,10 @@ func TestGetStats(t *testing.T) {
assert := With(t)
m, err := stats.NewManager(context.Background(), &stats.Config{})
assert(err, IsNil)
common.Must(err)
sc, err := m.RegisterCounter("test_counter")
assert(err, IsNil)
common.Must(err)
sc.Set(1)
@@ -50,7 +51,7 @@ func TestGetStats(t *testing.T) {
if tc.err {
assert(err, IsNotNil)
} else {
assert(err, IsNil)
common.Must(err)
assert(resp.Stat.Name, Equals, tc.name)
assert(resp.Stat.Value, Equals, tc.value)
}
@@ -61,25 +62,25 @@ func TestQueryStats(t *testing.T) {
assert := With(t)
m, err := stats.NewManager(context.Background(), &stats.Config{})
assert(err, IsNil)
common.Must(err)
sc1, err := m.RegisterCounter("test_counter")
assert(err, IsNil)
common.Must(err)
sc1.Set(1)
sc2, err := m.RegisterCounter("test_counter_2")
assert(err, IsNil)
common.Must(err)
sc2.Set(2)
sc3, err := m.RegisterCounter("test_counter_3")
assert(err, IsNil)
common.Must(err)
sc3.Set(3)
s := NewStatsServer(m)
resp, err := s.QueryStats(context.Background(), &QueryStatsRequest{
Pattern: "counter_",
})
assert(err, IsNil)
common.Must(err)
assert(len(resp.Stat), Equals, 2)
v2 := false