forked from quic-go/quic-go
fix logging of connection IDs in tracer test (#4118)
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
|||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Handshake tests", func() {
|
var _ = Describe("Tracer tests", func() {
|
||||||
addTracers := func(pers protocol.Perspective, conf *quic.Config) *quic.Config {
|
addTracers := func(pers protocol.Perspective, conf *quic.Config) *quic.Config {
|
||||||
enableQlog := mrand.Int()%3 != 0
|
enableQlog := mrand.Int()%3 != 0
|
||||||
enableCustomTracer := mrand.Int()%3 != 0
|
enableCustomTracer := mrand.Int()%3 != 0
|
||||||
@@ -30,10 +30,10 @@ var _ = Describe("Handshake tests", func() {
|
|||||||
if enableQlog {
|
if enableQlog {
|
||||||
tracerConstructors = append(tracerConstructors, func(_ context.Context, p logging.Perspective, connID quic.ConnectionID) *logging.ConnectionTracer {
|
tracerConstructors = append(tracerConstructors, func(_ context.Context, p logging.Perspective, connID quic.ConnectionID) *logging.ConnectionTracer {
|
||||||
if mrand.Int()%2 == 0 { // simulate that a qlog collector might only want to log some connections
|
if mrand.Int()%2 == 0 { // simulate that a qlog collector might only want to log some connections
|
||||||
fmt.Fprintf(GinkgoWriter, "%s qlog tracer deciding to not trace connection %x\n", p, connID)
|
fmt.Fprintf(GinkgoWriter, "%s qlog tracer deciding to not trace connection %s\n", p, connID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fmt.Fprintf(GinkgoWriter, "%s qlog tracing connection %x\n", p, connID)
|
fmt.Fprintf(GinkgoWriter, "%s qlog tracing connection %s\n", p, connID)
|
||||||
return qlog.NewConnectionTracer(utils.NewBufferedWriteCloser(bufio.NewWriter(&bytes.Buffer{}), io.NopCloser(nil)), p, connID)
|
return qlog.NewConnectionTracer(utils.NewBufferedWriteCloser(bufio.NewWriter(&bytes.Buffer{}), io.NopCloser(nil)), p, connID)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user