Skip to content

Commit

Permalink
sequential test
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalcaliskan committed Jan 3, 2022
1 parent cb6d787 commit 43033b8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
with:
go-version: 1.16.x
- name: Coverage Test
run: sudo go test ./... -race -coverprofile=coverage.txt -covermode=atomic
run: sudo go test ./... -race -p 1 -coverprofile=coverage.txt -covermode=atomic
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
with:
go-version: 1.16.x
- name: Coverage Test
run: sudo go test ./... -race -coverprofile=coverage.txt -covermode=atomic
run: sudo go test ./... -race -p 1 -coverprofile=coverage.txt -covermode=atomic
- name: Coverage Upload
run: bash <(curl -s https://codecov.io/bash)

Expand All @@ -113,7 +113,7 @@ jobs:
with:
go-version: 1.16.x
- name: Coverage Test
run: sudo go test ./... -race -coverprofile=coverage.txt -covermode=atomic
run: sudo go test ./... -race -p 1 -coverprofile=coverage.txt -covermode=atomic
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ineffassign:
ineffassign ./...

test:
sudo go test ./... -v
sudo go test ./... -p 1 -v

build:
go build -o bin/main main.go
Expand Down
10 changes: 4 additions & 6 deletions internal/raw/raw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ package raw

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

func TestStartFlooding(t *testing.T) {
var m sync.Mutex
srcIps := getIps()
srcPorts := getPorts()
macAddrs := getMacAddrs()
Expand Down Expand Up @@ -42,10 +39,11 @@ func TestStartFlooding(t *testing.T) {
defer cancel()
t.Logf("starting flood, caseName=%s, floodType=%s, floodMilliSeconds=%d\n", tc.name, tc.floodType, tc.floodMilliSeconds)
go func() {
m.Lock()
defer m.Unlock()
err := StartFlooding(tc.dstIp, tc.dstPort, tc.payloadLength, tc.floodType)
assert.Nil(t, err)
if err != nil {
t.Errorf("an error occured on flooding process: %s\n", err.Error())
return
}
}()

select {
Expand Down

0 comments on commit 43033b8

Please sign in to comment.