mark sync2 tests parallel (#1329)

This commit is contained in:
Egon Elbre 2019-02-20 11:22:53 +02:00 committed by GitHub
parent c3d3f41d30
commit edb500c1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 0 deletions

View File

@ -17,6 +17,8 @@ import (
) )
func TestCopy(t *testing.T) { func TestCopy(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
@ -29,6 +31,8 @@ func TestCopy(t *testing.T) {
} }
func TestCopy_Cancel(t *testing.T) { func TestCopy_Cancel(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() cancel()

View File

@ -16,6 +16,8 @@ import (
) )
func TestCycle_Basic(t *testing.T) { func TestCycle_Basic(t *testing.T) {
t.Parallel()
ctx := context.Background() ctx := context.Background()
var inplace sync2.Cycle var inplace sync2.Cycle

View File

@ -15,6 +15,8 @@ import (
) )
func TestFence(t *testing.T) { func TestFence(t *testing.T) {
t.Parallel()
var group errgroup.Group var group errgroup.Group
var fence sync2.Fence var fence sync2.Fence
var done int32 var done int32

View File

@ -13,6 +13,8 @@ import (
) )
func TestLimiterLimiting(t *testing.T) { func TestLimiterLimiting(t *testing.T) {
t.Parallel()
const N, Limit = 1000, 10 const N, Limit = 1000, 10
ctx := context.Background() ctx := context.Background()
limiter := sync2.NewLimiter(Limit) limiter := sync2.NewLimiter(Limit)
@ -30,6 +32,8 @@ func TestLimiterLimiting(t *testing.T) {
} }
func TestLimiterCancelling(t *testing.T) { func TestLimiterCancelling(t *testing.T) {
t.Parallel()
const N, Limit = 1000, 10 const N, Limit = 1000, 10
limiter := sync2.NewLimiter(Limit) limiter := sync2.NewLimiter(Limit)

View File

@ -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)) { 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.Run("File", func(t *testing.T) {
t.Parallel()
reader, writer, err := sync2.NewPipeFile("") reader, writer, err := sync2.NewPipeFile("")
if err != nil { if err != nil {
t.Fatal(err) 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) test(t, reader, writer)
}) })
t.Run("Memory", func(t *testing.T) { t.Run("Memory", func(t *testing.T) {
t.Parallel()
reader, writer, err := sync2.NewPipeMemory(1024) reader, writer, err := sync2.NewPipeMemory(1024)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -12,6 +12,8 @@ import (
) )
func TestSleep(t *testing.T) { func TestSleep(t *testing.T) {
t.Parallel()
const sleepError = time.Second / 2 // should be larger than most system error with regards to sleep const sleepError = time.Second / 2 // should be larger than most system error with regards to sleep
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -27,6 +29,8 @@ func TestSleep(t *testing.T) {
} }
func TestSleep_Cancel(t *testing.T) { func TestSleep_Cancel(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() cancel()

View File

@ -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)) { 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.Run("File", func(t *testing.T) {
t.Parallel()
readers, writer, err := sync2.NewTeeFile(2, "") readers, writer, err := sync2.NewTeeFile(2, "")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -60,6 +60,8 @@ func ExampleThrottle() {
} }
func TestThrottleBasic(t *testing.T) { func TestThrottleBasic(t *testing.T) {
t.Parallel()
throttle := sync2.NewThrottle() throttle := sync2.NewThrottle()
var stage int64 var stage int64
c := make(chan error, 1) c := make(chan error, 1)

View File

@ -13,6 +13,8 @@ import (
) )
func TestWaitGroup(t *testing.T) { func TestWaitGroup(t *testing.T) {
t.Parallel()
const Wait = 2 * time.Second const Wait = 2 * time.Second
const TimeError = time.Second / 2 const TimeError = time.Second / 2
@ -38,6 +40,8 @@ func TestWaitGroup(t *testing.T) {
} }
func TestWaitGroupClose(t *testing.T) { func TestWaitGroupClose(t *testing.T) {
t.Parallel()
const Wait = 2 * time.Second const Wait = 2 * time.Second
const LongWait = 10 * time.Second const LongWait = 10 * time.Second
const TimeError = time.Second / 2 const TimeError = time.Second / 2