refactor: move mock time to utils

This commit is contained in:
yusing
2025-04-25 08:21:27 +08:00
parent 5afa93a8f1
commit 59490dcac0
6 changed files with 21 additions and 17 deletions

View File

@@ -10,6 +10,7 @@ import (
. "github.com/yusing/go-proxy/internal/net/gphttp/accesslog"
"github.com/yusing/go-proxy/internal/task"
"github.com/yusing/go-proxy/internal/utils"
expect "github.com/yusing/go-proxy/internal/utils/testing"
)
@@ -56,7 +57,7 @@ func fmtLog(cfg *Config) (ts string, line string) {
t := time.Now()
logger := NewMockAccessLogger(testTask, cfg)
MockTimeNow(t)
utils.MockTimeNow(t)
buf = logger.AppendLog(buf, req, resp)
return t.Format(LogTimeFormat), string(buf)
}