Fix tests

This commit is contained in:
Andy Wang 2020-04-10 16:14:32 +01:00
parent a51d45f41a
commit 78b27c0705
3 changed files with 7 additions and 20 deletions

View File

@ -15,7 +15,7 @@ func TestGenerateObfs(t *testing.T) {
var sessionKey [32]byte var sessionKey [32]byte
rand.Read(sessionKey[:]) rand.Read(sessionKey[:])
run := func(obfuscator *Obfuscator, ct *testing.T) { run := func(obfuscator Obfuscator, ct *testing.T) {
obfsBuf := make([]byte, 512) obfsBuf := make([]byte, 512)
f := &Frame{} f := &Frame{}
_testFrame, _ := quick.Value(reflect.TypeOf(f), rand.New(rand.NewSource(42))) _testFrame, _ := quick.Value(reflect.TypeOf(f), rand.New(rand.NewSource(42)))

View File

@ -10,15 +10,10 @@ import (
"time" "time"
) )
var seshConfigOrdered = SessionConfig{ var seshConfigOrdered = SessionConfig{}
Obfuscator: nil,
Valve: nil,
}
var seshConfigUnordered = SessionConfig{ var seshConfigUnordered = SessionConfig{
Obfuscator: nil, Unordered: true,
Valve: nil,
Unordered: true,
} }
func TestRecvDataFromRemote(t *testing.T) { func TestRecvDataFromRemote(t *testing.T) {

View File

@ -52,17 +52,13 @@ func TestSwitchboard_Send(t *testing.T) {
t.Run("Ordered", func(t *testing.T) { t.Run("Ordered", func(t *testing.T) {
seshConfig := SessionConfig{ seshConfig := SessionConfig{
Obfuscator: nil, Unordered: false,
Valve: nil,
Unordered: false,
} }
doTest(seshConfig) doTest(seshConfig)
}) })
t.Run("Unordered", func(t *testing.T) { t.Run("Unordered", func(t *testing.T) {
seshConfig := SessionConfig{ seshConfig := SessionConfig{
Obfuscator: nil, Unordered: true,
Valve: nil,
Unordered: true,
} }
doTest(seshConfig) doTest(seshConfig)
}) })
@ -70,10 +66,7 @@ func TestSwitchboard_Send(t *testing.T) {
func BenchmarkSwitchboard_Send(b *testing.B) { func BenchmarkSwitchboard_Send(b *testing.B) {
hole := connutil.Discard() hole := connutil.Discard()
seshConfig := SessionConfig{ seshConfig := SessionConfig{}
Obfuscator: nil,
Valve: nil,
}
sesh := MakeSession(0, seshConfig) sesh := MakeSession(0, seshConfig)
sesh.sb.addConn(hole) sesh.sb.addConn(hole)
connId, _, err := sesh.sb.pickRandConn() connId, _, err := sesh.sb.pickRandConn()
@ -96,8 +89,7 @@ func BenchmarkSwitchboard_Send(b *testing.B) {
func TestSwitchboard_TxCredit(t *testing.T) { func TestSwitchboard_TxCredit(t *testing.T) {
seshConfig := SessionConfig{ seshConfig := SessionConfig{
Obfuscator: nil, Valve: MakeValve(1<<20, 1<<20),
Valve: MakeValve(1<<20, 1<<20),
} }
sesh := MakeSession(0, seshConfig) sesh := MakeSession(0, seshConfig)
hole := connutil.Discard() hole := connutil.Discard()