improved test

master
Charles Iliya Krempeaux 2015-10-10 14:01:12 -07:00
parent fc02e09eb5
commit 31952e7ae1
1 changed files with 13 additions and 0 deletions

View File

@ -12,6 +12,9 @@ import (
func TestFilteredRouterJustCreated(t *testing.T) {
randomness := rand.New(rand.NewSource( time.Now().UTC().UnixNano() ))
router := NewFilteredRouter(NewDiscardRouter(), func(string, map[string]interface{}) bool {
return false
})
@ -19,6 +22,16 @@ func TestFilteredRouterJustCreated(t *testing.T) {
t.Errorf("After trying to create a filtered router, expected it to be not nil, but was: %v", router)
}
message := fmt.Sprint("%x", randomness.Int63n(9999999999))
context := make(map[string]interface{})
limit := randomness.Int63n(30)
for i:=int64(0); i<limit; i++ {
context[ fmt.Sprintf("%x", randomness.Int63n(1000*limit)) ] = fmt.Sprintf("%x", randomness.Int63n(999999999999999))
}
router.Route(message, context) // Just make sure it doesn't panic or deadlok, by calling this.
}