fix: fast trace test

This commit is contained in:
sjlleo
2022-06-20 22:25:58 +08:00
parent c533dd34ab
commit ddffdb389a

View File

@@ -1,14 +1,24 @@
package fastTrace package fastTrace
import ( import (
"os"
"os/signal"
"testing" "testing"
"github.com/xgadget-lab/nexttrace/trace" "github.com/xgadget-lab/nexttrace/trace"
"github.com/xgadget-lab/nexttrace/wshandle"
) )
// ICMP Use Too Many Time to Wait So we don't test it. // ICMP Use Too Many Time to Wait So we don't test it.
func TestTCPTrace(t *testing.T) { func TestTCPTrace(t *testing.T) {
ft := FastTracer{} ft := FastTracer{}
// 建立 WebSocket 连接
w := wshandle.New()
w.Interrupt = make(chan os.Signal, 1)
signal.Notify(w.Interrupt, os.Interrupt)
defer func() {
w.Conn.Close()
}()
ft.TracerouteMethod = trace.TCPTrace ft.TracerouteMethod = trace.TCPTrace
ft.testCM() ft.testCM()
ft.testEDU() ft.testEDU()