Commit f2d976f6 authored by Janos Guljas's avatar Janos Guljas

adjust timings in p2p/protobuf tests

parent cc9ff2df
...@@ -74,7 +74,7 @@ func TestReader_timeout(t *testing.T) { ...@@ -74,7 +74,7 @@ func TestReader_timeout(t *testing.T) {
{ {
name: "NewReader", name: "NewReader",
readerFunc: func() protobuf.Reader { readerFunc: func() protobuf.Reader {
return protobuf.NewReader(newMessageReader(messages, 200*time.Millisecond)) return protobuf.NewReader(newMessageReader(messages, 400*time.Millisecond))
}, },
}, },
{ {
...@@ -82,7 +82,7 @@ func TestReader_timeout(t *testing.T) { ...@@ -82,7 +82,7 @@ func TestReader_timeout(t *testing.T) {
readerFunc: func() protobuf.Reader { readerFunc: func() protobuf.Reader {
_, r := protobuf.NewWriterAndReader( _, r := protobuf.NewWriterAndReader(
newNoopWriteCloser( newNoopWriteCloser(
newMessageReader(messages, 200*time.Millisecond), newMessageReader(messages, 400*time.Millisecond),
), ),
) )
return r return r
...@@ -96,9 +96,9 @@ func TestReader_timeout(t *testing.T) { ...@@ -96,9 +96,9 @@ func TestReader_timeout(t *testing.T) {
for i := 0; i < len(messages); i++ { for i := 0; i < len(messages); i++ {
var timeout time.Duration var timeout time.Duration
if i == 0 { if i == 0 {
timeout = 300 * time.Millisecond timeout = 600 * time.Millisecond
} else { } else {
timeout = 100 * time.Millisecond timeout = 200 * time.Millisecond
} }
ctx, cancel := context.WithTimeout(context.Background(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel() defer cancel()
...@@ -126,9 +126,9 @@ func TestReader_timeout(t *testing.T) { ...@@ -126,9 +126,9 @@ func TestReader_timeout(t *testing.T) {
for i := 0; i < len(messages); i++ { for i := 0; i < len(messages); i++ {
var timeout time.Duration var timeout time.Duration
if i == 0 { if i == 0 {
timeout = 300 * time.Millisecond timeout = 600 * time.Millisecond
} else { } else {
timeout = 100 * time.Millisecond timeout = 200 * time.Millisecond
} }
err := r.ReadMsgWithTimeout(timeout, &msg) err := r.ReadMsgWithTimeout(timeout, &msg)
if i == 0 { if i == 0 {
...@@ -203,14 +203,14 @@ func TestWriter_timeout(t *testing.T) { ...@@ -203,14 +203,14 @@ func TestWriter_timeout(t *testing.T) {
{ {
name: "NewWriter", name: "NewWriter",
writerFunc: func() (protobuf.Writer, <-chan string) { writerFunc: func() (protobuf.Writer, <-chan string) {
w, msgs := newMessageWriter(200 * time.Millisecond) w, msgs := newMessageWriter(400 * time.Millisecond)
return protobuf.NewWriter(w), msgs return protobuf.NewWriter(w), msgs
}, },
}, },
{ {
name: "NewWriterAndReader", name: "NewWriterAndReader",
writerFunc: func() (protobuf.Writer, <-chan string) { writerFunc: func() (protobuf.Writer, <-chan string) {
w, msgs := newMessageWriter(200 * time.Millisecond) w, msgs := newMessageWriter(400 * time.Millisecond)
writer, _ := protobuf.NewWriterAndReader(newNoopReadCloser(w)) writer, _ := protobuf.NewWriterAndReader(newNoopReadCloser(w))
return writer, msgs return writer, msgs
}, },
...@@ -223,9 +223,9 @@ func TestWriter_timeout(t *testing.T) { ...@@ -223,9 +223,9 @@ func TestWriter_timeout(t *testing.T) {
for i, m := range messages { for i, m := range messages {
var timeout time.Duration var timeout time.Duration
if i == 0 { if i == 0 {
timeout = 300 * time.Millisecond timeout = 600 * time.Millisecond
} else { } else {
timeout = 100 * time.Millisecond timeout = 200 * time.Millisecond
} }
ctx, cancel := context.WithTimeout(context.Background(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel() defer cancel()
...@@ -253,9 +253,9 @@ func TestWriter_timeout(t *testing.T) { ...@@ -253,9 +253,9 @@ func TestWriter_timeout(t *testing.T) {
for i, m := range messages { for i, m := range messages {
var timeout time.Duration var timeout time.Duration
if i == 0 { if i == 0 {
timeout = 300 * time.Millisecond timeout = 600 * time.Millisecond
} else { } else {
timeout = 100 * time.Millisecond timeout = 200 * time.Millisecond
} }
err := w.WriteMsgWithTimeout(timeout, &pb.Message{ err := w.WriteMsgWithTimeout(timeout, &pb.Message{
Text: m, Text: m,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment