Skip to content

Commit

Permalink
refactor(go/adbc/driver): moved validation tests closer to drivers to…
Browse files Browse the repository at this point in the history
… have access to internal util functions
  • Loading branch information
xborder committed Jan 21, 2025
1 parent 2a795ef commit d6d6a27
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
10 changes: 5 additions & 5 deletions go/adbc/driver/bigquery/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"cloud.google.com/go/bigquery"
"github.com/apache/arrow-adbc/go/adbc"
driver "github.com/apache/arrow-adbc/go/adbc/driver/bigquery"
"github.com/apache/arrow-adbc/go/adbc/validation"
"github.com/apache/arrow-adbc/go/adbc/driver/internal"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/array"
"github.com/apache/arrow-go/v18/arrow/decimal128"
Expand Down Expand Up @@ -548,9 +548,9 @@ func withQuirks(t *testing.T, fn func(quirks *BigQueryQuirks)) {
// todo: finish other callbacks and make this validation test suite pass
func TestValidation(t *testing.T) {
withQuirks(t, func(q *BigQueryQuirks) {
suite.Run(t, &validation.DatabaseTests{Quirks: q})
suite.Run(t, &validation.ConnectionTests{Quirks: q})
suite.Run(t, &validation.StatementTests{Quirks: q})
suite.Run(t, &internal.DatabaseTests{Quirks: q})
suite.Run(t, &internal.ConnectionTests{Quirks: q})
suite.Run(t, &internal.StatementTests{Quirks: q})
})
}

Expand Down Expand Up @@ -1482,4 +1482,4 @@ func (suite *BigQueryTests) TestMetadataGetObjectsColumnsXdbc() {

}

var _ validation.DriverQuirks = (*BigQueryQuirks)(nil)
var _ internal.DriverQuirks = (*BigQueryQuirks)(nil)
3 changes: 1 addition & 2 deletions go/adbc/driver/flightsql/flightsql_adbc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"github.com/apache/arrow-adbc/go/adbc"
driver "github.com/apache/arrow-adbc/go/adbc/driver/flightsql"
"github.com/apache/arrow-adbc/go/adbc/driver/internal"
"github.com/apache/arrow-adbc/go/adbc/validation"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/array"
"github.com/apache/arrow-go/v18/arrow/flight"
Expand Down Expand Up @@ -1878,7 +1877,7 @@ type GetObjectsTests struct {
suite.Suite

Driver adbc.Driver
Quirks validation.DriverQuirks
Quirks internal.DriverQuirks
Cnxn adbc.Connection
ctx context.Context
DB adbc.Database
Expand Down
22 changes: 11 additions & 11 deletions go/adbc/driver/flightsql/flightsql_adbc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (

"github.com/apache/arrow-adbc/go/adbc"
driver "github.com/apache/arrow-adbc/go/adbc/driver/flightsql"
"github.com/apache/arrow-adbc/go/adbc/validation"
"github.com/apache/arrow-adbc/go/adbc/driver/internal"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/array"
"github.com/apache/arrow-go/v18/arrow/flight"
Expand Down Expand Up @@ -293,9 +293,9 @@ func TestADBCFlightSQL(t *testing.T) {
defer db.Close()

q := &FlightSQLQuirks{db: db}
suite.Run(t, &validation.DatabaseTests{Quirks: q})
suite.Run(t, &validation.ConnectionTests{Quirks: q})
suite.Run(t, &validation.StatementTests{Quirks: q})
suite.Run(t, &internal.DatabaseTests{Quirks: q})
suite.Run(t, &internal.ConnectionTests{Quirks: q})
suite.Run(t, &internal.StatementTests{Quirks: q})

suite.Run(t, &DefaultDialOptionsTests{Quirks: q})
suite.Run(t, &HeaderTests{Quirks: q})
Expand Down Expand Up @@ -371,9 +371,9 @@ func TestADBCFlightSQLWithHeader(t *testing.T) {
defer db.Close()

q := &FlightSQLWithHeaderQuirks{FlightSQLQuirks{db: db}}
suite.Run(t, &validation.DatabaseTests{Quirks: q})
suite.Run(t, &validation.ConnectionTests{Quirks: q})
suite.Run(t, &validation.StatementTests{Quirks: q})
suite.Run(t, &internal.DatabaseTests{Quirks: q})
suite.Run(t, &internal.ConnectionTests{Quirks: q})
suite.Run(t, &internal.StatementTests{Quirks: q})
suite.Run(t, &OptionTests{Quirks: q})
suite.Run(t, &PartitionTests{Quirks: q})
suite.Run(t, &StatementTests{Quirks: q})
Expand All @@ -385,7 +385,7 @@ type DefaultDialOptionsTests struct {
suite.Suite

Driver adbc.Driver
Quirks validation.DriverQuirks
Quirks internal.DriverQuirks

ctx context.Context
DB adbc.Database
Expand Down Expand Up @@ -480,7 +480,7 @@ type OptionTests struct {
suite.Suite

Driver adbc.Driver
Quirks validation.DriverQuirks
Quirks internal.DriverQuirks
}

func (suite *OptionTests) SetupTest() {
Expand Down Expand Up @@ -561,7 +561,7 @@ type PartitionTests struct {
suite.Suite

Driver adbc.Driver
Quirks validation.DriverQuirks
Quirks internal.DriverQuirks

DB adbc.Database
Cnxn adbc.Connection
Expand Down Expand Up @@ -610,7 +610,7 @@ type StatementTests struct {
suite.Suite

Driver adbc.Driver
Quirks validation.DriverQuirks
Quirks internal.DriverQuirks

DB adbc.Database
Cnxn adbc.Connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// driver development for ADBC drivers. It provides a series of utilities
// and defined tests that can be used to validate a driver follows the
// correct and expected behavior.
package validation
package internal

import (
"context"
Expand Down
8 changes: 4 additions & 4 deletions go/adbc/driver/snowflake/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import (
"testing"

"github.com/apache/arrow-adbc/go/adbc"
"github.com/apache/arrow-adbc/go/adbc/driver/internal"
"github.com/apache/arrow-adbc/go/adbc/driver/internal/driverbase"
driver "github.com/apache/arrow-adbc/go/adbc/driver/snowflake"
"github.com/apache/arrow-adbc/go/adbc/validation"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/array"
"github.com/apache/arrow-go/v18/arrow/decimal128"
Expand Down Expand Up @@ -302,9 +302,9 @@ func withQuirks(t *testing.T, fn func(*SnowflakeQuirks)) {

func TestValidation(t *testing.T) {
withQuirks(t, func(q *SnowflakeQuirks) {
suite.Run(t, &validation.DatabaseTests{Quirks: q})
suite.Run(t, &validation.ConnectionTests{Quirks: q})
suite.Run(t, &validation.StatementTests{Quirks: q})
suite.Run(t, &internal.DatabaseTests{Quirks: q})
suite.Run(t, &internal.ConnectionTests{Quirks: q})
suite.Run(t, &internal.StatementTests{Quirks: q})
})
}

Expand Down

0 comments on commit d6d6a27

Please sign in to comment.