diff --git a/neo4j/test-integration/auth_test.go b/neo4j/test-integration/auth_test.go index 945a04d2..a4adec87 100644 --- a/neo4j/test-integration/auth_test.go +++ b/neo4j/test-integration/auth_test.go @@ -26,7 +26,10 @@ import ( "github.com/neo4j/neo4j-go-driver/v5/neo4j/test-integration/dbserver" ) -func TestAuthentication(tt *testing.T) { +func TestAuthentication(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() getDriverAndSession := func(token neo4j.AuthToken) (neo4j.Driver, neo4j.Session) { @@ -38,7 +41,7 @@ func TestAuthentication(tt *testing.T) { return driver, driver.NewSession(neo4j.SessionConfig{AccessMode: neo4j.AccessModeRead}) } - tt.Run("when wrong credentials are provided, it should fail with authentication error", func(t *testing.T) { + outer.Run("when wrong credentials are provided, it should fail with authentication error", func(t *testing.T) { token := neo4j.BasicAuth("wrong", "wrong", "") driver, session := getDriverAndSession(token) defer driver.Close() diff --git a/neo4j/test-integration/bookmark_test.go b/neo4j/test-integration/bookmark_test.go index d4dec530..80c9ca81 100644 --- a/neo4j/test-integration/bookmark_test.go +++ b/neo4j/test-integration/bookmark_test.go @@ -28,6 +28,9 @@ import ( ) func TestBookmark(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() createNodeInTx := func(driver neo4j.Driver) string { diff --git a/neo4j/test-integration/dbconn_test.go b/neo4j/test-integration/dbconn_test.go index fa0d9488..6fe3c9fe 100644 --- a/neo4j/test-integration/dbconn_test.go +++ b/neo4j/test-integration/dbconn_test.go @@ -88,8 +88,11 @@ func BenchmarkQuery(b *testing.B) { } } -// Tests the specification of the internal connection connection API -func TestConnectionConformance(ot *testing.T) { +// Tests the specification of the internal connection API +func TestConnectionConformance(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server, boltConn := makeRawConnection(&log.Console{Errors: true, Infos: true, Warns: true, Debugs: true}, nil) defer boltConn.Close(context.Background()) @@ -330,7 +333,7 @@ func TestConnectionConformance(ot *testing.T) { } // Run all above in sequence for _, c := range cases { - ot.Run(c.name, func(t *testing.T) { + outer.Run(c.name, func(t *testing.T) { c.fun(t, boltConn) if !boltConn.IsAlive() { t.Error("Connection died") @@ -338,7 +341,7 @@ func TestConnectionConformance(ot *testing.T) { }) } // Run some of the above at random as one test - ot.Run("Random sequence", func(t *testing.T) { + outer.Run("Random sequence", func(t *testing.T) { randoms := make([]int, 25) for i := range randoms { randoms[i] = int(randInt() % int64(len(cases))) @@ -441,7 +444,7 @@ func TestConnectionConformance(ot *testing.T) { }, } for _, c := range cases { - ot.Run(c.name, func(t *testing.T) { + outer.Run(c.name, func(t *testing.T) { c.fun(t, boltConn) if !boltConn.IsAlive() { t.Error("Connection died") @@ -460,7 +463,7 @@ func TestConnectionConformance(ot *testing.T) { }) } // Run some of the above at random as one test - ot.Run("Random reset sequence", func(t *testing.T) { + outer.Run("Random reset sequence", func(t *testing.T) { randoms := make([]int, 25) for i := range randoms { randoms[i] = int(randInt() % int64(len(cases))) @@ -476,7 +479,7 @@ func TestConnectionConformance(ot *testing.T) { }) // Write really big query - ot.Run("Really big query", func(t *testing.T) { + outer.Run("Really big query", func(t *testing.T) { query := "RETURN $x" bigBuilder := strings.Builder{} s := "0123456789" @@ -558,7 +561,7 @@ func TestConnectionConformance(ot *testing.T) { } // Temporal types - ot.Run("Temporal types", func(tt *testing.T) { + outer.Run("Temporal types", func(tt *testing.T) { london, _ := time.LoadLocation("Europe/London") // In Cypher @@ -673,7 +676,7 @@ func TestConnectionConformance(ot *testing.T) { }) // Bookmark tests - ot.Run("Bookmarks", func(tt *testing.T) { + outer.Run("Bookmarks", func(tt *testing.T) { boltConn.Reset(context.Background()) lastBookmark := boltConn.Bookmark() @@ -745,7 +748,7 @@ func TestConnectionConformance(ot *testing.T) { }) // Enterprise feature - ot.Run("Multidatabase", func(tt *testing.T) { + outer.Run("Multidatabase", func(tt *testing.T) { selector, supportsMultidatabase := boltConn.(idb.DatabaseSelector) if !supportsMultidatabase { tt.Skipf("Database %s:%s does not support multidatabase functionality", boltConn.ServerName(), boltConn.ServerVersion()) diff --git a/neo4j/test-integration/driver_test.go b/neo4j/test-integration/driver_test.go index fb8ef7e0..3d580cc8 100644 --- a/neo4j/test-integration/driver_test.go +++ b/neo4j/test-integration/driver_test.go @@ -29,6 +29,9 @@ import ( ) func TestDriver(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() outer.Run("VerifyConnectivity", func(inner *testing.T) { diff --git a/neo4j/test-integration/examples_test.go b/neo4j/test-integration/examples_test.go index 5691112d..c9b5fc65 100644 --- a/neo4j/test-integration/examples_test.go +++ b/neo4j/test-integration/examples_test.go @@ -31,6 +31,9 @@ import ( ) func TestExamples(outer *testing.T) { + if testing.Short() { + outer.Skip() + } outer.Run("Single Instance", func(inner *testing.T) { var ( @@ -810,6 +813,10 @@ func addPersonNode(driver neo4j.Driver, name string) (int64, error) { // end::read-write-transaction[] func TestExamplesDatabaseSelection(t *testing.T) { + if testing.Short() { + t.Skip() + } + driver := dbserver.GetDbServer().Driver() defer driver.Close() // tag::database-selection[] diff --git a/neo4j/test-integration/multidatabase_test.go b/neo4j/test-integration/multidatabase_test.go index 8a0694ad..5d99e3d1 100644 --- a/neo4j/test-integration/multidatabase_test.go +++ b/neo4j/test-integration/multidatabase_test.go @@ -26,7 +26,11 @@ import ( "github.com/neo4j/neo4j-go-driver/v5/neo4j/test-integration/dbserver" ) -func TestMultidatabase(ot *testing.T) { +func TestMultidatabase(outer *testing.T) { + if testing.Short() { + outer.Skip() + } + server := dbserver.GetDbServer() driver := server.Driver() @@ -34,11 +38,11 @@ func TestMultidatabase(ot *testing.T) { // Need > 4.0 for database support if server.Version.LessThan(V4) { - ot.Skip("Versions prior to 4.0 does not support multidatabase") + outer.Skip("Versions prior to 4.0 does not support multidatabase") } if !server.IsEnterprise { - ot.Skip("Need enterprise version to test multidatabase") + outer.Skip("Need enterprise version to test multidatabase") } // Ensure that a test database exists using system database @@ -46,12 +50,12 @@ func TestMultidatabase(ot *testing.T) { sysSess := driver.NewSession(neo4j.SessionConfig{DatabaseName: "system"}) defer sysSess.Close() _, err := sysSess.Run("DROP DATABASE testdb IF EXISTS", nil) - assertNil(ot, err) + assertNil(outer, err) _, err = sysSess.Run("CREATE DATABASE testdb", nil) - assertNil(ot, err) + assertNil(outer, err) }() - ot.Run("Node created in test db should not be visible in default db", func(t *testing.T) { + outer.Run("Node created in test db should not be visible in default db", func(t *testing.T) { // Create node in testdb session testSess := driver.NewSession(neo4j.SessionConfig{DatabaseName: "testdb"}) randId := createRandomNode(t, testSess) diff --git a/neo4j/test-integration/routing_test.go b/neo4j/test-integration/routing_test.go index ba21729a..cf89fb51 100644 --- a/neo4j/test-integration/routing_test.go +++ b/neo4j/test-integration/routing_test.go @@ -27,6 +27,9 @@ import ( ) func TestRouting(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() var session neo4j.Session diff --git a/neo4j/test-integration/session_test.go b/neo4j/test-integration/session_test.go index 37210b93..efa48f92 100644 --- a/neo4j/test-integration/session_test.go +++ b/neo4j/test-integration/session_test.go @@ -31,6 +31,9 @@ import ( ) func TestSession(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() outer.Run("with read access mode", func(inner *testing.T) { diff --git a/neo4j/test-integration/spatialtypes_test.go b/neo4j/test-integration/spatialtypes_test.go index ceb57d28..2c4cf208 100644 --- a/neo4j/test-integration/spatialtypes_test.go +++ b/neo4j/test-integration/spatialtypes_test.go @@ -27,7 +27,11 @@ import ( "github.com/neo4j/neo4j-go-driver/v5/neo4j/test-integration/dbserver" ) -func TestSpatialTypes(st *testing.T) { +func TestSpatialTypes(outer *testing.T) { + if testing.Short() { + outer.Skip() + } + const ( WGS84SrID uint32 = 4326 WGS843DSrID uint32 = 4979 @@ -38,7 +42,7 @@ func TestSpatialTypes(st *testing.T) { server := dbserver.GetDbServer() driver := server.Driver() if server.Version.LessThan(V340) { - st.Skip("Spatial types are only available after neo4j 3.4.0 release") + outer.Skip("Spatial types are only available after neo4j 3.4.0 release") } // Returns a random 2D/3D point (depending on seq) with random values for X, Y and Z when applicable. @@ -103,7 +107,7 @@ func TestSpatialTypes(st *testing.T) { } // Verifies that a single 2D point can be received. - st.Run("Receive", func(rt *testing.T) { + outer.Run("Receive", func(rt *testing.T) { rt.Run("Point2D", func(t *testing.T) { p1 := single(t, driver, "RETURN point({x: 39.111748, y:-76.775635})", nil).(neo4j.Point2D) p2 := neo4j.Point2D{X: 39.111748, Y: -76.775635, SpatialRefId: CartesianSrID} @@ -118,7 +122,7 @@ func TestSpatialTypes(st *testing.T) { }) }) - st.Run("Send", func(tt *testing.T) { + outer.Run("Send", func(tt *testing.T) { // Verifies that a single 2D point can be sent (and received) tt.Run("Point2D", func(t *testing.T) { p1 := neo4j.Point2D{SpatialRefId: WGS84SrID, X: 51.5044585, Y: -0.105658} diff --git a/neo4j/test-integration/summary_test.go b/neo4j/test-integration/summary_test.go index 8d8efc3d..dff109e7 100644 --- a/neo4j/test-integration/summary_test.go +++ b/neo4j/test-integration/summary_test.go @@ -8,6 +8,9 @@ import ( ) func TestResultSummary(outer *testing.T) { + if testing.Short() { + outer.Skip() + } const extraDatabase = "extra" diff --git a/neo4j/test-integration/temporaltypes2_test.go b/neo4j/test-integration/temporaltypes2_test.go index baba3ca3..2f4783ad 100644 --- a/neo4j/test-integration/temporaltypes2_test.go +++ b/neo4j/test-integration/temporaltypes2_test.go @@ -30,6 +30,9 @@ import ( ) func TestTemporalTypes2(outer *testing.T) { + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() driver := server.Driver() if server.Version.LessThan(V340) { diff --git a/neo4j/test-integration/temporaltypes_test.go b/neo4j/test-integration/temporaltypes_test.go index 867ae6ac..a9d78be4 100644 --- a/neo4j/test-integration/temporaltypes_test.go +++ b/neo4j/test-integration/temporaltypes_test.go @@ -32,9 +32,9 @@ import ( ) func TestTemporalTypes(outer *testing.T) { - const ( - numberOfRandomValues = 200 - ) + if testing.Short() { + outer.Skip() + } server := dbserver.GetDbServer() var driver neo4j.Driver diff --git a/neo4j/test-integration/timeout_test.go b/neo4j/test-integration/timeout_test.go index 47ad653d..e6c3affd 100644 --- a/neo4j/test-integration/timeout_test.go +++ b/neo4j/test-integration/timeout_test.go @@ -28,6 +28,10 @@ import ( ) func TestTimeoutAndLifetime(outer *testing.T) { + if testing.Short() { + outer.Skip() + } + server := dbserver.GetDbServer() outer.Run("should error when ConnectionAcquisitionTimeout is hit", func(t *testing.T) { diff --git a/neo4j/test-integration/transaction_test.go b/neo4j/test-integration/transaction_test.go index 041660f0..4359534c 100644 --- a/neo4j/test-integration/transaction_test.go +++ b/neo4j/test-integration/transaction_test.go @@ -29,6 +29,10 @@ import ( ) func TestTransaction(outer *testing.T) { + if testing.Short() { + outer.Skip() + } + server := dbserver.GetDbServer() var err error var driver neo4j.Driver diff --git a/neo4j/test-integration/types_test.go b/neo4j/test-integration/types_test.go index 1ec9df35..11071490 100644 --- a/neo4j/test-integration/types_test.go +++ b/neo4j/test-integration/types_test.go @@ -30,6 +30,10 @@ import ( ) func TestTypes(outer *testing.T) { + if testing.Short() { + outer.Skip() + } + server := dbserver.GetDbServer() var err error var driver neo4j.Driver diff --git a/neo4j/test-integration/values_unsupported_test.go b/neo4j/test-integration/values_unsupported_test.go deleted file mode 100644 index 40bc0605..00000000 --- a/neo4j/test-integration/values_unsupported_test.go +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) "Neo4j" - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package test_integration - -/* -import ( - "time" - - "github.com/neo4j/neo4j-go-driver/v5/neo4j" - "github.com/neo4j/neo4j-go-driver/v5/neo4j/test-integration/dbserver" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Unsupported Types [V1]", func() { - const ( - WGS84SrID int = 4326 - WGS843DSrID int = 4979 - ) - - var server *control.SingleInstance - var err error - var driver neo4j.Driver - var session neo4j.Session - - BeforeEach(func() { - server, err = control.EnsureSingleInstance() - Expect(err).To(BeNil()) - Expect(server).NotTo(BeNil()) - - driver, err = server.Driver() - Expect(err).To(BeNil()) - Expect(driver).NotTo(BeNil()) - - if versionOfDriver(driver).GreaterThanOrEqual(V340) { - Skip("this test is targeted for server version less than neo4j 3.4.0") - } - - session, err = driver.Session(neo4j.AccessModeWrite) - Expect(err).To(BeNil()) - Expect(session).NotTo(BeNil()) - }) - - AfterEach(func() { - if session != nil { - session.Close() - } - - if driver != nil { - driver.Close() - } - }) - - testSend := func(data interface{}) { - _, err = session.Run("WITH $x RETURN 1", map[string]interface{}{"x": data}) - //Expect(err).To(BeConnectorErrorWithCode(0x501)) - Expect(err).ToNot(BeNil()) - errDesc := err.Error() - Expect(errDesc).To(ContainSubstring("unable to generate run message")) - //Expect(err).To(BeConnectorErrorWithDescription("unable to generate run message")) - } - - Context("Send", func() { - It("should fail sending Point (2D)", func() { - testSend(neo4j.NewPoint2D(WGS84SrID, 1.0, 1.0)) - }) - - It("should fail sending Point (3D)", func() { - testSend(neo4j.NewPoint3D(WGS843DSrID, 1.0, 1.0, 1.0)) - }) - - It("should fail sending Duration", func() { - testSend(neo4j.DurationOf(1, 1, 1, 1)) - }) - - It("should fail sending Date", func() { - testSend(neo4j.DateOf(time.Now())) - }) - - It("should fail sending LocalDateTime", func() { - testSend(neo4j.LocalDateTimeOf(time.Now())) - }) - - It("should fail sending LocalTime", func() { - testSend(neo4j.LocalTimeOf(time.Now())) - }) - - It("should fail sending OffsetTime", func() { - testSend(neo4j.OffsetTimeOf(time.Now())) - }) - - It("should fail sending DateTime with Offset", func() { - testSend(time.Now().In(time.FixedZone("Offset", 2400))) - }) - - It("should fail sending DateTime with Zone", func() { - testSend(time.Now().In(time.Local)) - }) - }) -}) -*/ diff --git a/testkit/unittests.py b/testkit/unittests.py index 17fd9414..5ff914c1 100644 --- a/testkit/unittests.py +++ b/testkit/unittests.py @@ -19,5 +19,4 @@ def run(args): if os.environ.get("TEST_IN_TEAMCITY", False): cmd = cmd + ["-v", "-json"] - run(cmd + ["./neo4j"]) - run(cmd + ["./neo4j/internal/..."]) + run(cmd + ["-short", "./..."])