Skip to content

Commit 212dee2

Browse files
committed
idle test & readme
2 parents c537668 + 914fc2c commit 212dee2

File tree

6 files changed

+60
-3
lines changed

6 files changed

+60
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## v6.1.0 - 2020-03-09
6+
7+
- Reworked and tested new connection pools with multiple queries per connection
8+
- Socket Read- and WriteTimeout replaced with context timeout
9+
- Mock assert fix
10+
511
## v6.0.0 - 2019-12-22
612

713
- 2.4 RethinkDB support

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ test:
33
go tool cover -html=cover.out -o cover.html
44
rm -f cover.out
55

6+
integration:
7+
go test -race gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/...
8+
69
benchpool:
710
go test -v -cpu 1,2,4,8,16,24,32,64,128,256 -bench=BenchmarkConnectionPool -run ^$ ./internal/integration/tests/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
![RethinkDB-go Logo](https://raw.github.com/wiki/rethinkdb/rethinkdb-go/gopher-and-thinker-s.png "Golang Gopher and RethinkDB Thinker")
1010

11-
Current version: v6.0.0 (RethinkDB v2.4)
11+
Current version: v6.1.0 (RethinkDB v2.4)
1212

1313
Please note that this version of the driver only supports versions of RethinkDB using the v0.4 protocol (any versions of the driver older than RethinkDB 2.0 will not work).
1414

encoding/decoder.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ func valueDecoder(dv, sv reflect.Value, blank bool) decoderFunc {
7878

7979
if dv.IsValid() {
8080
dv = indirect(dv, false)
81-
if blank {
81+
if sv.Kind() == reflect.Ptr {
82+
sv = indirect(sv, false)
83+
dv.Set(sv)
84+
} else if blank {
8285
dv.Set(reflect.Zero(dv.Type()))
8386
}
8487
}

internal/integration/tests/session_test.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,49 @@ func (s *RethinkSuite) TestSessionConnectUsername(c *test.C) {
158158
_, err = r.Expr("Hello World").Run(session)
159159
c.Assert(err, test.IsNil)
160160
}
161+
162+
func (s *RethinkSuite) TestSessionIdleConnectionRemainsUsableSmallTimeout(c *test.C) {
163+
session, err := r.Connect(r.ConnectOpts{
164+
Address: url,
165+
NumRetries: 1,
166+
InitialCap: 1,
167+
ReadTimeout: 10 * time.Millisecond,
168+
WriteTimeout: 10 * time.Millisecond,
169+
})
170+
c.Assert(err, test.IsNil)
171+
172+
time.Sleep(20 * time.Millisecond)
173+
174+
var num int
175+
err = r.Expr(5).ReadOne(&num, session)
176+
c.Assert(err, test.IsNil)
177+
c.Assert(num, test.Equals, 5)
178+
179+
time.Sleep(20 * time.Millisecond)
180+
181+
err = r.Expr(6).ReadOne(&num, session)
182+
c.Assert(err, test.IsNil)
183+
c.Assert(num, test.Equals, 6)
184+
}
185+
186+
func (s *RethinkSuite) TestSessionIdleConnectionRemainsUsableNoTimeout(c *test.C) {
187+
session, err := r.Connect(r.ConnectOpts{
188+
Address: url,
189+
NumRetries: 1,
190+
InitialCap: 1,
191+
})
192+
c.Assert(err, test.IsNil)
193+
194+
time.Sleep(10 * time.Millisecond)
195+
196+
var num int
197+
err = r.Expr(5).ReadOne(&num, session)
198+
c.Assert(err, test.IsNil)
199+
c.Assert(num, test.Equals, 5)
200+
201+
time.Sleep(10 * time.Millisecond)
202+
203+
err = r.Expr(6).ReadOne(&num, session)
204+
c.Assert(err, test.IsNil)
205+
c.Assert(num, test.Equals, 6)
206+
}

mock_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package rethinkdb
22

33
import (
44
"fmt"
5-
65
"testing"
76

87
test "gopkg.in/check.v1"

0 commit comments

Comments
 (0)