Merge pull request #57 from moreati/snow-networking-test

snow: Add test for Sender.Context()
This commit is contained in:
Stephen Buttolph 2020-04-09 18:20:00 -04:00 committed by GitHub
commit fef453405c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,7 @@
package sender package sender
import ( import (
"reflect"
"sync" "sync"
"testing" "testing"
"time" "time"
@ -17,6 +18,20 @@ import (
"github.com/ava-labs/gecko/utils/logging" "github.com/ava-labs/gecko/utils/logging"
) )
func TestSenderContext(t *testing.T) {
context := snow.DefaultContextTest()
sender := Sender{}
sender.Initialize(
context,
&ExternalSenderTest{},
&router.ChainRouter{},
&timeout.Manager{},
)
if res := sender.Context(); !reflect.DeepEqual(res, context) {
t.Fatalf("Got %#v, expected %#v", res, context)
}
}
func TestTimeout(t *testing.T) { func TestTimeout(t *testing.T) {
tm := timeout.Manager{} tm := timeout.Manager{}
tm.Initialize(time.Millisecond) tm.Initialize(time.Millisecond)