From 78b27c0705f1e8613524844fcef106b88607f58f Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Fri, 10 Apr 2020 16:14:32 +0100 Subject: [PATCH] Fix tests --- internal/multiplex/obfs_test.go | 2 +- internal/multiplex/session_test.go | 9 ++------- internal/multiplex/switchboard_test.go | 16 ++++------------ 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/internal/multiplex/obfs_test.go b/internal/multiplex/obfs_test.go index 4afea28..be7dd1b 100644 --- a/internal/multiplex/obfs_test.go +++ b/internal/multiplex/obfs_test.go @@ -15,7 +15,7 @@ func TestGenerateObfs(t *testing.T) { var sessionKey [32]byte rand.Read(sessionKey[:]) - run := func(obfuscator *Obfuscator, ct *testing.T) { + run := func(obfuscator Obfuscator, ct *testing.T) { obfsBuf := make([]byte, 512) f := &Frame{} _testFrame, _ := quick.Value(reflect.TypeOf(f), rand.New(rand.NewSource(42))) diff --git a/internal/multiplex/session_test.go b/internal/multiplex/session_test.go index 3502199..5f24d94 100644 --- a/internal/multiplex/session_test.go +++ b/internal/multiplex/session_test.go @@ -10,15 +10,10 @@ import ( "time" ) -var seshConfigOrdered = SessionConfig{ - Obfuscator: nil, - Valve: nil, -} +var seshConfigOrdered = SessionConfig{} var seshConfigUnordered = SessionConfig{ - Obfuscator: nil, - Valve: nil, - Unordered: true, + Unordered: true, } func TestRecvDataFromRemote(t *testing.T) { diff --git a/internal/multiplex/switchboard_test.go b/internal/multiplex/switchboard_test.go index 7d65b02..af14c1d 100644 --- a/internal/multiplex/switchboard_test.go +++ b/internal/multiplex/switchboard_test.go @@ -52,17 +52,13 @@ func TestSwitchboard_Send(t *testing.T) { t.Run("Ordered", func(t *testing.T) { seshConfig := SessionConfig{ - Obfuscator: nil, - Valve: nil, - Unordered: false, + Unordered: false, } doTest(seshConfig) }) t.Run("Unordered", func(t *testing.T) { seshConfig := SessionConfig{ - Obfuscator: nil, - Valve: nil, - Unordered: true, + Unordered: true, } doTest(seshConfig) }) @@ -70,10 +66,7 @@ func TestSwitchboard_Send(t *testing.T) { func BenchmarkSwitchboard_Send(b *testing.B) { hole := connutil.Discard() - seshConfig := SessionConfig{ - Obfuscator: nil, - Valve: nil, - } + seshConfig := SessionConfig{} sesh := MakeSession(0, seshConfig) sesh.sb.addConn(hole) connId, _, err := sesh.sb.pickRandConn() @@ -96,8 +89,7 @@ func BenchmarkSwitchboard_Send(b *testing.B) { func TestSwitchboard_TxCredit(t *testing.T) { seshConfig := SessionConfig{ - Obfuscator: nil, - Valve: MakeValve(1<<20, 1<<20), + Valve: MakeValve(1<<20, 1<<20), } sesh := MakeSession(0, seshConfig) hole := connutil.Discard()