Skip to content

Commit

Permalink
replace t.error/fatal with assert/request (/tracker/inflights_test.go)
Browse files Browse the repository at this point in the history
Signed-off-by: Xinyuan Du <[email protected]>
  • Loading branch information
MrDXY committed Apr 1, 2024
1 parent a02bb0f commit b2403c5
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.NotEmpty(t, recover(), "Add() did not panic")
}()
in.Add(100, 1024)
})
Expand Down

0 comments on commit b2403c5

Please sign in to comment.