81db46b725
- Fix dead-code branch in bind.go host assignment (always use endpoint hash) - Return descriptive error on bypass match in connect.go (was masking as success) - Update bypass test in connect_test.go for new error behavior - Extract entrypoint subpackage from monolithic entrypoint.go (6 files) - Fix observeStats event-loss bug (break -> fallthrough on retry success) - Add 47 unit tests across handler, connect, bind, metadata packages - Add architecture doc comments to all key files - Build and vet clean, 173 tests pass with -race
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package tunnel
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/go-gost/core/logger"
|
|
)
|
|
|
|
// TestMain sets up a non-nil default logger for all tests in this package.
|
|
func TestMain(m *testing.M) {
|
|
logger.SetDefault(nopLogger{})
|
|
os.Exit(m.Run())
|
|
}
|
|
|
|
type nopLogger struct {
|
|
logger.Logger
|
|
}
|
|
|
|
func (nopLogger) Debugf(format string, args ...any) {}
|
|
func (nopLogger) Infof(format string, args ...any) {}
|
|
func (nopLogger) Warnf(format string, args ...any) {}
|
|
func (nopLogger) Errorf(format string, args ...any) {}
|
|
func (nopLogger) Tracef(format string, args ...any) {}
|
|
func (nopLogger) Debug(args ...any) {}
|
|
func (nopLogger) Info(args ...any) {}
|
|
func (nopLogger) Warn(args ...any) {}
|
|
func (nopLogger) Error(args ...any) {}
|
|
func (nopLogger) Trace(args ...any) {}
|
|
func (nopLogger) Fatal(args ...any) {}
|
|
func (nopLogger) Fatalf(format string, args ...any) {}
|
|
func (nopLogger) GetLevel() logger.LogLevel { return logger.ErrorLevel }
|
|
func (nopLogger) IsLevelEnabled(level logger.LogLevel) bool { return false }
|
|
func (nopLogger) WithFields(fields map[string]any) logger.Logger { return nopLogger{} }
|
|
|
|
// testLogger returns a non-nil Logger usable in tests.
|
|
func testLogger() logger.Logger { return nopLogger{} } |