Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Dec 11, 2024
1 parent 849986d commit 27b52da
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/display_loop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestDisplayLoop(t *testing.T) {
enrichment.current = 0
assert.Equal(t, []string{"None"}, enrichment.getNames())
assert.Equal(t, []string{"SrcAddr", "SrcPort", "DstAddr", "DstPort"}, enrichment.getCols())

Expand Down
9 changes: 7 additions & 2 deletions cmd/flow_capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var (
lastFlows = []config.GenericMap{}

features = displayLoop{
current: 6,
current: featureDefaultIndex,
all: []displayLoopItem{
{name: "Raw"},
{name: "Standard", columns: []string{"Dir", "Interfaces", "Proto", "Dscp", "Bytes", "Packets"}},
Expand All @@ -48,7 +48,7 @@ var (
}

enrichment = displayLoop{
current: 4,
current: enrichmentDefaultIndex,
all: []displayLoopItem{
{name: "None", columns: []string{"SrcAddr", "SrcPort", "DstAddr", "DstPort"}},
{name: "Zone", columns: []string{"SrcZone", "DstZone"}},
Expand All @@ -60,6 +60,11 @@ var (
}
)

const (
featureDefaultIndex = 6 // All feats.
enrichmentDefaultIndex = 4 // Resources
)

func runFlowCapture(_ *cobra.Command, _ []string) {
go func() {
scanner()
Expand Down
1 change: 1 addition & 0 deletions cmd/flow_capture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestFlowTableMultipleFlows(t *testing.T) {

// set display to standard without enrichment
features.current = 1
enrichment.current = 0

// set time and bytes per flow
flowTime := 1704063600000
Expand Down
2 changes: 2 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func setup() {
// clear filters and previous flows
regexes = []string{}
lastFlows = []config.GenericMap{}
features.current = featureDefaultIndex
enrichment.current = enrichmentDefaultIndex
}

func resetTime() {
Expand Down

0 comments on commit 27b52da

Please sign in to comment.