Skip to content

Commit

Permalink
Merge pull request #190 from MrDXY/replace-test-errors-with-assert-tr…
Browse files Browse the repository at this point in the history
…acker

Test: Replace t.error/fatal with assert/request in [/tracker/inflights_test.go]
  • Loading branch information
ahrtr authored Apr 6, 2024
2 parents d5e24b4 + ca660d6 commit f7321f1
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tracker/inflights_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tracker
import (
"testing"

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

Expand Down Expand Up @@ -203,24 +204,18 @@ func TestInflightsFull(t *testing.T) {

addUntilFull := func(begin, end int) {
for i := begin; i < end; i++ {
if in.Full() {
t.Fatalf("full at %d, want %d", i, end)
}
require.False(t, in.Full(), "full at %d, want %d", i, end)
in.Add(uint64(i), uint64(100+i))
}
if !in.Full() {
t.Fatalf("not full at %d", end)
}
require.True(t, in.Full(), "not full at %d", end)
}

addUntilFull(0, tc.fullAt)
in.FreeLE(tc.freeLE)
addUntilFull(tc.fullAt, tc.againAt)

defer func() {
if r := recover(); r == nil {
t.Errorf("Add() did not panic")
}
assert.NotNil(t, recover(), "Add() did not panic")
}()
in.Add(100, 1024)
})
Expand Down

0 comments on commit f7321f1

Please sign in to comment.