Skip to content

Commit

Permalink
add tests for pcap parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
satta committed Aug 22, 2019
1 parent f564e43 commit 0653103
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pcap_flowtuple_source_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package gommunityid

import (
"log"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
)

func TestPcapFlowTupleSource(t *testing.T) {
testfiles, err := filepath.Glob("testdata/*.pcap")
if err != nil {
t.Fatal(err)
}
i := 0
for _, testfile := range testfiles {
ftChan, err := PcapFlowTupleSource(testfile)
if err != nil {
log.Fatal(err)
}
for _ = range ftChan {
i++
}
log.Printf("read %s with %d packets", testfile, i)
assert.Greater(t, i, 0)
}
}
Binary file added testdata/icmp.pcap
Binary file not shown.
Binary file added testdata/icmp6.pcap
Binary file not shown.
Binary file added testdata/ipv6.pcap
Binary file not shown.
Binary file added testdata/sctp.pcap
Binary file not shown.
Binary file added testdata/tcp.pcap
Binary file not shown.
Binary file added testdata/udp.pcap
Binary file not shown.

0 comments on commit 0653103

Please sign in to comment.