mark sync2 tests parallel (#1329)
This commit is contained in:
parent
c3d3f41d30
commit
edb500c1dc
@ -17,6 +17,8 @@ import (
|
||||
)
|
||||
|
||||
func TestCopy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
@ -29,6 +31,8 @@ func TestCopy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCopy_Cancel(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
|
@ -16,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
func TestCycle_Basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
var inplace sync2.Cycle
|
||||
|
@ -15,6 +15,8 @@ import (
|
||||
)
|
||||
|
||||
func TestFence(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var group errgroup.Group
|
||||
var fence sync2.Fence
|
||||
var done int32
|
||||
|
@ -13,6 +13,8 @@ import (
|
||||
)
|
||||
|
||||
func TestLimiterLimiting(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const N, Limit = 1000, 10
|
||||
ctx := context.Background()
|
||||
limiter := sync2.NewLimiter(Limit)
|
||||
@ -30,6 +32,8 @@ func TestLimiterLimiting(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLimiterCancelling(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const N, Limit = 1000, 10
|
||||
limiter := sync2.NewLimiter(Limit)
|
||||
|
||||
|
@ -76,7 +76,9 @@ func TestPipe_CloseWithError(t *testing.T) {
|
||||
}
|
||||
|
||||
func testPipes(t *testing.T, test func(t *testing.T, reader sync2.PipeReader, writer sync2.PipeWriter)) {
|
||||
t.Parallel()
|
||||
t.Run("File", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
reader, writer, err := sync2.NewPipeFile("")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@ -84,6 +86,7 @@ func testPipes(t *testing.T, test func(t *testing.T, reader sync2.PipeReader, wr
|
||||
test(t, reader, writer)
|
||||
})
|
||||
t.Run("Memory", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
reader, writer, err := sync2.NewPipeMemory(1024)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -12,6 +12,8 @@ import (
|
||||
)
|
||||
|
||||
func TestSleep(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const sleepError = time.Second / 2 // should be larger than most system error with regards to sleep
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@ -27,6 +29,8 @@ func TestSleep(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSleep_Cancel(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
|
@ -81,7 +81,9 @@ func TestTee_CloseWithError(t *testing.T) {
|
||||
}
|
||||
|
||||
func testTees(t *testing.T, test func(t *testing.T, readers []sync2.PipeReader, writer sync2.PipeWriter)) {
|
||||
t.Parallel()
|
||||
t.Run("File", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
readers, writer, err := sync2.NewTeeFile(2, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -60,6 +60,8 @@ func ExampleThrottle() {
|
||||
}
|
||||
|
||||
func TestThrottleBasic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
throttle := sync2.NewThrottle()
|
||||
var stage int64
|
||||
c := make(chan error, 1)
|
||||
|
@ -13,6 +13,8 @@ import (
|
||||
)
|
||||
|
||||
func TestWaitGroup(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const Wait = 2 * time.Second
|
||||
const TimeError = time.Second / 2
|
||||
|
||||
@ -38,6 +40,8 @@ func TestWaitGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWaitGroupClose(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const Wait = 2 * time.Second
|
||||
const LongWait = 10 * time.Second
|
||||
const TimeError = time.Second / 2
|
||||
|
Loading…
Reference in New Issue
Block a user