Skip to content

Commit d84c090

Browse files
committed
gbn: run unit tests in parallel
1 parent c0eea25 commit d84c090

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

gbn/gbn_conn_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
)
1313

1414
func TestNormal(t *testing.T) {
15+
t.Parallel()
16+
1517
s1Chan := make(chan []byte, 10)
1618
s2Chan := make(chan []byte, 10)
1719

@@ -86,6 +88,8 @@ func TestNormal(t *testing.T) {
8688
// so will call Recv or Send which will hang indefinitely unless we set a
8789
// timeout.
8890
func TestServerHandshakeTimeout(t *testing.T) {
91+
t.Parallel()
92+
8993
s1Chan := make(chan []byte, 10)
9094
s2Chan := make(chan []byte, 10)
9195

@@ -188,6 +192,8 @@ func TestServerHandshakeTimeout(t *testing.T) {
188192
}
189193

190194
func TestDroppedMessage(t *testing.T) {
195+
t.Parallel()
196+
191197
s1Chan := make(chan []byte, 10)
192198
s2Chan := make(chan []byte, 10)
193199

@@ -268,6 +274,8 @@ func TestDroppedMessage(t *testing.T) {
268274
}
269275

270276
func TestDroppedACKs(t *testing.T) {
277+
t.Parallel()
278+
271279
s1Chan := make(chan []byte, 10)
272280
s2Chan := make(chan []byte, 10)
273281

@@ -357,6 +365,8 @@ func TestDroppedACKs(t *testing.T) {
357365
}
358366

359367
func TestReceiveDuplicateMessages(t *testing.T) {
368+
t.Parallel()
369+
360370
s1Chan := make(chan []byte, 10)
361371
s2Chan := make(chan []byte, 10)
362372

@@ -438,6 +448,8 @@ func TestReceiveDuplicateMessages(t *testing.T) {
438448
}
439449

440450
func TestReceiveDuplicateDataAndACKs(t *testing.T) {
451+
t.Parallel()
452+
441453
s1Chan := make(chan []byte, 10)
442454
s2Chan := make(chan []byte, 10)
443455

@@ -536,6 +548,8 @@ func TestReceiveDuplicateDataAndACKs(t *testing.T) {
536548
}
537549

538550
func TestBidirectional(t *testing.T) {
551+
t.Parallel()
552+
539553
s1Chan := make(chan []byte, 10)
540554
s2Chan := make(chan []byte, 10)
541555

@@ -619,6 +633,8 @@ func TestBidirectional(t *testing.T) {
619633
}
620634

621635
func TestSendNBeforeNeedingAck(t *testing.T) {
636+
t.Parallel()
637+
622638
s1Chan := make(chan []byte, 10)
623639
s2Chan := make(chan []byte, 10)
624640

@@ -682,6 +698,8 @@ func TestSendNBeforeNeedingAck(t *testing.T) {
682698
}
683699

684700
func TestDropFirstNPackets(t *testing.T) {
701+
t.Parallel()
702+
685703
s1Chan := make(chan []byte, 10)
686704
s2Chan := make(chan []byte, 10)
687705

@@ -769,6 +787,8 @@ func TestDropFirstNPackets(t *testing.T) {
769787
}
770788

771789
func TestBidirectional2(t *testing.T) {
790+
t.Parallel()
791+
772792
s1Chan := make(chan []byte, 10)
773793
s2Chan := make(chan []byte, 10)
774794

@@ -898,6 +918,8 @@ func TestBidirectional2(t *testing.T) {
898918
}
899919

900920
func TestSendingIsNonBlockingUpToN(t *testing.T) {
921+
t.Parallel()
922+
901923
s1Chan := make(chan []byte, 10)
902924
s2Chan := make(chan []byte, 10)
903925

@@ -994,6 +1016,8 @@ func TestSendingIsNonBlockingUpToN(t *testing.T) {
9941016
}
9951017

9961018
func TestSendingLargeNumberOfMessages(t *testing.T) {
1019+
t.Parallel()
1020+
9971021
s1Chan := make(chan []byte, 10)
9981022
s2Chan := make(chan []byte, 10)
9991023

@@ -1066,6 +1090,8 @@ func TestSendingLargeNumberOfMessages(t *testing.T) {
10661090
}
10671091

10681092
func TestResendAfterTimeout(t *testing.T) {
1093+
t.Parallel()
1094+
10691095
s1Chan := make(chan []byte, 10)
10701096
s2Chan := make(chan []byte, 10)
10711097

@@ -1121,6 +1147,8 @@ func TestResendAfterTimeout(t *testing.T) {
11211147
}
11221148

11231149
func TestPayloadSplitting(t *testing.T) {
1150+
t.Parallel()
1151+
11241152
s1Chan := make(chan []byte, 10)
11251153
s2Chan := make(chan []byte, 10)
11261154

@@ -1185,6 +1213,8 @@ func setUpClientServerConns(t *testing.T, n uint8,
11851213
cWrite, sWrite func(ctx context.Context, b []byte) error,
11861214
opts ...Option) (*GoBackNConn, *GoBackNConn, func()) {
11871215

1216+
t.Helper()
1217+
11881218
var (
11891219
server *GoBackNConn
11901220
err error

gbn/queue_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
)
88

99
func TestQueueSize(t *testing.T) {
10+
t.Parallel()
11+
1012
q := newQueue(&queueCfg{s: 4})
1113

1214
require.Equal(t, uint8(0), q.size())

gbn/ticker_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ var tickers = []struct {
2828
// same principle behaviors when accessed via the ticker.Ticker interface
2929
// methods.
3030
func TestInterfaceTickers(t *testing.T) {
31+
t.Parallel()
32+
3133
for _, test := range tickers {
3234
test := test
3335
t.Run(test.name, func(t *testing.T) {
36+
t.Parallel()
37+
3438
testTicker(t, test.ticker)
3539
})
3640
}

0 commit comments

Comments
 (0)