Create dummy stats object for tests

This commit is contained in:
Justin Li 2014-07-23 17:30:38 -04:00
parent 88d68a99a2
commit 7a64ae2d1b

View file

@ -13,6 +13,7 @@ import (
"github.com/chihaya/bencode" "github.com/chihaya/bencode"
"github.com/chihaya/chihaya/config" "github.com/chihaya/chihaya/config"
"github.com/chihaya/chihaya/stats"
"github.com/chihaya/chihaya/tracker" "github.com/chihaya/chihaya/tracker"
_ "github.com/chihaya/chihaya/backend/noop" _ "github.com/chihaya/chihaya/backend/noop"
@ -23,6 +24,10 @@ type params map[string]string
var infoHash = string([]byte{0x89, 0xd4, 0xbc, 0x52, 0x11, 0x16, 0xca, 0x1d, 0x42, 0xa2, 0xf3, 0x0d, 0x1f, 0x27, 0x4d, 0x94, 0xe4, 0x68, 0x1d, 0xaf}) var infoHash = string([]byte{0x89, 0xd4, 0xbc, 0x52, 0x11, 0x16, 0xca, 0x1d, 0x42, 0xa2, 0xf3, 0x0d, 0x1f, 0x27, 0x4d, 0x94, 0xe4, 0x68, 0x1d, 0xaf})
func init() {
stats.DefaultStats = stats.New(config.StatsConfig{})
}
func setupTracker(cfg *config.Config) (*httptest.Server, error) { func setupTracker(cfg *config.Config) (*httptest.Server, error) {
tkr, err := tracker.New(cfg) tkr, err := tracker.New(cfg)
if err != nil { if err != nil {