Skip to content

Commit

Permalink
test: update run_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
md-irohas committed Jul 3, 2023
1 parent 0edcd91 commit 7817c81
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions rcap/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,31 @@ func TestRunnerIsSamplingMode(t *testing.T) {
}
}

func TestRunnerDoSample(t *testing.T) {
func TestRunnnerPrintSamplingResult(t *testing.T) {
c := makeConfig()
c.CheckAndFormat()
r, _ := NewRunner(c)

// numCapturePackets == 0
r.printSamplingResult()

// numCapturePackets == 2, numSampledPackets == 1
r.numCapturedPackets = 2
r.numSampledPackets = 1
r.printSamplingResult()
}

func TestRunnerDoSampling(t *testing.T) {
c := makeConfig()
c.Rcap.Sampling = 0.1
c.CheckAndFormat()

r, _ := NewRunner(c)
r.numStatsPackets = 10

count := 0
for i := 0; i < 100; i++ {
if r.doSample() {
if r.doSampling() {
count++
}
}
Expand Down

0 comments on commit 7817c81

Please sign in to comment.