From da26e230a0e4d3f38589cfc563de4a2f84e929f4 Mon Sep 17 00:00:00 2001 From: Nikita Vetoshkin Date: Mon, 5 Sep 2016 11:06:08 +0500 Subject: [PATCH] rafthttp: fix misprint in readBytesLimit value and make test path in restricted test environments --- rafthttp/msg_codec.go | 2 +- rafthttp/msg_codec_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rafthttp/msg_codec.go b/rafthttp/msg_codec.go index 8bd4d0119..bf1f6bc00 100644 --- a/rafthttp/msg_codec.go +++ b/rafthttp/msg_codec.go @@ -43,7 +43,7 @@ type messageDecoder struct { } var ( - readBytesLimit uint64 = 512 * 1024 // 512 MB + readBytesLimit uint64 = 512 * 1024 * 1024 // 512 MB ErrExceedSizeLimit = errors.New("rafthttp: error limit exceeded") ) diff --git a/rafthttp/msg_codec_test.go b/rafthttp/msg_codec_test.go index 56043a41f..6e9277132 100644 --- a/rafthttp/msg_codec_test.go +++ b/rafthttp/msg_codec_test.go @@ -23,6 +23,12 @@ import ( ) func TestMessage(t *testing.T) { + // Lower readBytesLimit to make test pass in restricted resources environment + originalLimit := readBytesLimit + readBytesLimit = 1000 + defer func() { + readBytesLimit = originalLimit + }() tests := []struct { msg raftpb.Message encodeErr error