Skip to content

Commit

Permalink
test: fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalcaliskan committed May 16, 2022
1 parent 89e2b8a commit 482f9c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
with:
go-version: 1.17.x
- name: Coverage Test
run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic
run: make coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
with:
go-version: 1.17.x
- name: Coverage Test
run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic
run: make coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ ineffassign:
test:
sudo go test ./... -race -v

coverage:
sudo go test ./... -race -coverprofile=coverage.txt -covermode=atomic

build:
go build -o bin/main main.go

Expand Down
9 changes: 5 additions & 4 deletions internal/raw/raw_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package raw

import (
"github.com/stretchr/testify/assert"
"math/rand"
"testing"
"time"

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

func TestStartFloodingFailure(t *testing.T) {
Expand All @@ -26,16 +27,16 @@ func TestStartFlooding(t *testing.T) {
srcMacAddr, dstMacAddr []byte
}{
{"100byte_syn", TypeSyn, 10, srcPorts[rand.Intn(len(srcPorts))],
443, 50, srcIps[rand.Intn(len(srcIps))], "93.184.216.34",
443, 50, srcIps[rand.Intn(len(srcIps))], "213.238.175.187",
macAddrs[rand.Intn(len(macAddrs))], macAddrs[rand.Intn(len(macAddrs))]},
{
"100byte_ack", TypeAck, 10, srcPorts[rand.Intn(len(srcPorts))],
443, 50, srcIps[rand.Intn(len(srcIps))], "93.184.216.34",
443, 50, srcIps[rand.Intn(len(srcIps))], "213.238.175.187",
macAddrs[rand.Intn(len(macAddrs))], macAddrs[rand.Intn(len(macAddrs))],
},
{
"100byte_synack", TypeSynAck, 10, srcPorts[rand.Intn(len(srcPorts))],
443, 50, srcIps[rand.Intn(len(srcIps))], "93.184.216.34",
443, 50, srcIps[rand.Intn(len(srcIps))], "213.238.175.187",
macAddrs[rand.Intn(len(macAddrs))], macAddrs[rand.Intn(len(macAddrs))],
},
}
Expand Down

0 comments on commit 482f9c8

Please sign in to comment.