Просмотр исходного кода

Fix: update tests to work with e864421a/5ef3c39

Rod Hynes 6 лет назад
Родитель
Сommit
1b6a5d7cff

+ 0 - 2
psiphon/common/fragmentor/fragmentor_test.go

@@ -22,13 +22,11 @@ package fragmentor
 import (
 	"bytes"
 	"context"
-	"fmt"
 	"math/rand"
 	"net"
 	"testing"
 	"time"
 
-	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/parameters"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/prng"

+ 9 - 9
psiphon/common/profiles_test.go

@@ -45,31 +45,31 @@ func (logger *testLogger) panic() {
 	panic("unexpected log call")
 }
 
-func (logger *testLogger) WithContext() LogContext {
-	return &testLoggerContext{}
+func (logger *testLogger) WithTrace() LogTrace {
+	return &testLoggerTrace{}
 }
 
-func (logger *testLogger) WithTraceFields(fields LogFields) LogContext {
-	return &testLoggerContext{}
+func (logger *testLogger) WithTraceFields(fields LogFields) LogTrace {
+	return &testLoggerTrace{}
 }
 
 func (logger *testLogger) LogMetric(metric string, fields LogFields) {
 	panic("unexpected log call")
 }
 
-type testLoggerContext struct {
+type testLoggerTrace struct {
 }
 
-func (context *testLoggerContext) Debug(args ...interface{}) {
+func (logger *testLoggerTrace) Debug(args ...interface{}) {
 }
 
-func (context *testLoggerContext) Info(args ...interface{}) {
+func (logger *testLoggerTrace) Info(args ...interface{}) {
 }
 
-func (context *testLoggerContext) Warning(args ...interface{}) {
+func (logger *testLoggerTrace) Warning(args ...interface{}) {
 	panic("unexpected log call")
 }
 
-func (context *testLoggerContext) Error(args ...interface{}) {
+func (logger *testLoggerTrace) Error(args ...interface{}) {
 	panic("unexpected log call")
 }

+ 0 - 1
psiphon/common/quic/quic_test.go

@@ -27,7 +27,6 @@ import (
 	"testing"
 	"time"
 
-	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/prng"
 	"golang.org/x/sync/errgroup"

+ 15 - 15
psiphon/common/tactics/tactics_test.go

@@ -847,14 +847,14 @@ func newTestLogger() *testLogger {
 	return &testLogger{}
 }
 
-func (l *testLogger) WithContext() common.LogContext {
-	return &testLoggerContext{context: stacktrace.GetParentFunctionName()}
+func (l *testLogger) WithTrace() common.LogTrace {
+	return &testLoggerTrace{trace: stacktrace.GetParentFunctionName()}
 }
 
-func (l *testLogger) WithTraceFields(fields common.LogFields) common.LogContext {
-	return &testLoggerContext{
-		context: stacktrace.GetParentFunctionName(),
-		fields:  fields,
+func (l *testLogger) WithTraceFields(fields common.LogFields) common.LogTrace {
+	return &testLoggerTrace{
+		trace:  stacktrace.GetParentFunctionName(),
+		fields: fields,
 	}
 }
 
@@ -862,27 +862,27 @@ func (l *testLogger) LogMetric(metric string, fields common.LogFields) {
 	fmt.Printf("METRIC: %s: fields=%+v\n", metric, fields)
 }
 
-type testLoggerContext struct {
-	context string
-	fields  common.LogFields
+type testLoggerTrace struct {
+	trace  string
+	fields common.LogFields
 }
 
-func (l *testLoggerContext) log(priority, message string) {
-	fmt.Printf("%s: %s: %s fields=%+v\n", priority, l.context, message, l.fields)
+func (l *testLoggerTrace) log(priority, message string) {
+	fmt.Printf("%s: %s: %s fields=%+v\n", priority, l.trace, message, l.fields)
 }
 
-func (l *testLoggerContext) Debug(args ...interface{}) {
+func (l *testLoggerTrace) Debug(args ...interface{}) {
 	l.log("DEBUG", fmt.Sprint(args...))
 }
 
-func (l *testLoggerContext) Info(args ...interface{}) {
+func (l *testLoggerTrace) Info(args ...interface{}) {
 	l.log("INFO", fmt.Sprint(args...))
 }
 
-func (l *testLoggerContext) Warning(args ...interface{}) {
+func (l *testLoggerTrace) Warning(args ...interface{}) {
 	l.log("WARNING", fmt.Sprint(args...))
 }
 
-func (l *testLoggerContext) Error(args ...interface{}) {
+func (l *testLoggerTrace) Error(args ...interface{}) {
 	l.log("ERROR", fmt.Sprint(args...))
 }