Skip to content

Commit

Permalink
Merge pull request #33 from ali-ince/1.7-minor-changes
Browse files Browse the repository at this point in the history
Couple of minor changes
  • Loading branch information
ali-ince authored Nov 1, 2018
2 parents 520f8ab + 5c13505 commit ab9f89f
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ core
.glide/

build
vendor
175 changes: 175 additions & 0 deletions neo4j/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions neo4j/Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/golang/mock"
version = "1.1.1"

[[constraint]]
name = "github.com/neo4j-drivers/gobolt"
version = "1.7.x"

[[constraint]]
name = "github.com/onsi/ginkgo"
version = "1.6.0"

[[constraint]]
name = "github.com/onsi/gomega"
version = "1.4.2"

[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"

[prune]
go-tests = true
unused-packages = true
2 changes: 0 additions & 2 deletions neo4j/gobolt_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ func configToGoboltConfig(config *Config) *gobolt.Config {
MaxConnLifetime: config.MaxConnectionLifetime,
ConnAcquisitionTimeout: config.ConnectionAcquisitionTimeout,
SockConnectTimeout: config.SocketConnectTimeout,
SockRecvTimeout: 0,
SockSendTimeout: 0,
SockKeepalive: config.SocketKeepalive,
ValueHandlers: []gobolt.ValueHandler{
&nodeValueHandler{},
Expand Down
6 changes: 3 additions & 3 deletions neo4j/test-integration/timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ var _ = Describe("Timeout and Lifetime", func() {
Expect(log.Infos).Should(ContainElement(ContainSubstring("reached its maximum lifetime")))
})

XIt("should timeout connection when SocketConnectTimeout is hit", func() {
It("should timeout connection when SocketConnectTimeout is hit", func() {
var err error
var driver neo4j.Driver
var session neo4j.Session

driver, err = neo4j.NewDriver("bolt://192.168.0.0:8080", server.AuthToken(), server.Config(), func(config *neo4j.Config) {
driver, err = neo4j.NewDriver("bolt://10.255.255.1:8080", server.AuthToken(), server.Config(), func(config *neo4j.Config) {
config.Log = log
config.SocketConnectTimeout = 5 * time.Second
config.SocketConnectTimeout = 1 * time.Second
})
Expect(err).To(BeNil())
Expect(driver).NotTo(BeNil())
Expand Down
47 changes: 24 additions & 23 deletions neo4j/test-integration/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package test_integration
import (
"github.com/neo4j/neo4j-go-driver/neo4j"
"github.com/neo4j/neo4j-go-driver/neo4j/test-integration/control"
"math/rand"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -252,29 +253,29 @@ var _ = Describe("Types", func() {
Expect(result.Err()).To(BeNil())
})

//It("should be able to send and receive large string property", func() {
// var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
//
// randSeq := func (n int) string {
// b := make([]rune, n)
// for i := range b {
// b[i] = letters[rand.Intn(len(letters))]
// }
// return string(b)
// }
//
// value := randSeq(20 * 1024)
//
// result, err = session.Run("CREATE (n {value: $value}) RETURN n.value", &map[string]interface{}{"value": value})
// Expect(err).To(BeNil())
//
// if result.Next() {
// Expect(result.Record().GetByIndex(0)).To(BeAssignableToTypeOf(""))
// Expect(result.Record().GetByIndex(0)).To(Equal(value))
// }
// Expect(result.Next()).To(BeFalse())
// Expect(result.Err()).To(BeNil())
//})
It("should be able to send and receive large string property", func() {
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

randSeq := func(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}

value := randSeq(20 * 1024)

result, err = session.Run("CREATE (n {value: $value}) RETURN n.value", map[string]interface{}{"value": value})
Expect(err).To(BeNil())

if result.Next() {
Expect(result.Record().GetByIndex(0)).To(BeAssignableToTypeOf(""))
Expect(result.Record().GetByIndex(0)).To(Equal(value))
}
Expect(result.Next()).To(BeFalse())
Expect(result.Err()).To(BeNil())
})

It("should be able to receive a node with properties", func() {
result, err = session.Run("CREATE (n:Person:Manager {id: 1, name: 'a name'}) RETURN n", nil)
Expand Down

0 comments on commit ab9f89f

Please sign in to comment.