|
@ -2,11 +2,12 @@ package libp2pquic |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"bytes" |
|
|
"bytes" |
|
|
"compress/gzip" |
|
|
|
|
|
"fmt" |
|
|
"fmt" |
|
|
"io/ioutil" |
|
|
"io/ioutil" |
|
|
"os" |
|
|
"os" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/klauspost/compress/zstd" |
|
|
|
|
|
|
|
|
"github.com/lucas-clemente/quic-go/logging" |
|
|
"github.com/lucas-clemente/quic-go/logging" |
|
|
|
|
|
|
|
|
. "github.com/onsi/ginkgo" |
|
|
. "github.com/onsi/ginkgo" |
|
@ -43,12 +44,12 @@ var _ = Describe("qlogger", func() { |
|
|
logger := newQlogger(qlogDir, logging.PerspectiveServer, []byte{0xde, 0xad, 0xbe, 0xef}) |
|
|
logger := newQlogger(qlogDir, logging.PerspectiveServer, []byte{0xde, 0xad, 0xbe, 0xef}) |
|
|
file := getFile() |
|
|
file := getFile() |
|
|
Expect(string(file.Name()[0])).To(Equal(".")) |
|
|
Expect(string(file.Name()[0])).To(Equal(".")) |
|
|
Expect(file.Name()).To(HaveSuffix(".qlog.gz.swp")) |
|
|
Expect(file.Name()).To(HaveSuffix(".qlog.zst.swp")) |
|
|
// close the logger. This should move the file.
|
|
|
// close the logger. This should move the file.
|
|
|
Expect(logger.Close()).To(Succeed()) |
|
|
Expect(logger.Close()).To(Succeed()) |
|
|
file = getFile() |
|
|
file = getFile() |
|
|
Expect(string(file.Name()[0])).ToNot(Equal(".")) |
|
|
Expect(string(file.Name()[0])).ToNot(Equal(".")) |
|
|
Expect(file.Name()).To(HaveSuffix(".qlog.gz")) |
|
|
Expect(file.Name()).To(HaveSuffix(".qlog.zst")) |
|
|
Expect(file.Name()).To(And( |
|
|
Expect(file.Name()).To(And( |
|
|
ContainSubstring("server"), |
|
|
ContainSubstring("server"), |
|
|
ContainSubstring("deadbeef"), |
|
|
ContainSubstring("deadbeef"), |
|
@ -76,7 +77,7 @@ var _ = Describe("qlogger", func() { |
|
|
compressed, err := ioutil.ReadFile(qlogDir + "/" + getFile().Name()) |
|
|
compressed, err := ioutil.ReadFile(qlogDir + "/" + getFile().Name()) |
|
|
Expect(err).ToNot(HaveOccurred()) |
|
|
Expect(err).ToNot(HaveOccurred()) |
|
|
Expect(compressed).ToNot(Equal("foobar")) |
|
|
Expect(compressed).ToNot(Equal("foobar")) |
|
|
gz, err := gzip.NewReader(bytes.NewReader(compressed)) |
|
|
gz, err := zstd.NewReader(bytes.NewReader(compressed)) |
|
|
Expect(err).ToNot(HaveOccurred()) |
|
|
Expect(err).ToNot(HaveOccurred()) |
|
|
data, err := ioutil.ReadAll(gz) |
|
|
data, err := ioutil.ReadAll(gz) |
|
|
Expect(err).ToNot(HaveOccurred()) |
|
|
Expect(err).ToNot(HaveOccurred()) |
|
|