You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "lidavidm (via GitHub)" <gi...@apache.org> on 2023/03/01 20:30:33 UTC
[GitHub] [arrow-adbc] lidavidm commented on a diff in pull request #485: fix(go/adbc/driver/flightsql): don't require GetSqlInfo support
lidavidm commented on code in PR #485:
URL: https://github.com/apache/arrow-adbc/pull/485#discussion_r1122268209
##########
go/adbc/driver/flightsql/flightsql_adbc_test.go:
##########
@@ -936,3 +937,52 @@ func (suite *TLSTests) TestInvalidOptions() {
_, _, err = stmt.ExecuteQuery(suite.ctx)
suite.Contains(err.Error(), "Unavailable")
}
+
+type ConnectionTests struct {
+ suite.Suite
+
+ alloc *memory.CheckedAllocator
+ server flight.Server
+ service *flight.BaseFlightServer
+
+ Driver adbc.Driver
+ DB adbc.Database
+ Cnxn adbc.Connection
+ ctx context.Context
+}
+
+func (suite *ConnectionTests) SetupSuite() {
+ suite.alloc = memory.NewCheckedAllocator(memory.DefaultAllocator)
+
+ suite.server = flight.NewServerWithMiddleware(nil)
+ suite.NoError(suite.server.Init("localhost:0"))
+ suite.service = &flight.BaseFlightServer{}
+ suite.server.RegisterFlightService(suite.service)
+
+ go func() {
+ // Explicitly ignore error
+ _ = suite.server.Serve()
+ }()
+
+ var err error
+ suite.ctx = context.Background()
+ suite.Driver = driver.Driver{Alloc: suite.alloc}
+ suite.DB, err = suite.Driver.NewDatabase(map[string]string{
+ adbc.OptionKeyURI: "grpc+tcp://" + suite.server.Addr().String(),
+ })
+ suite.Require().NoError(err)
+ suite.Cnxn, err = suite.DB.Open(suite.ctx)
+ suite.Require().NoError(err)
+}
+
+func (suite *ConnectionTests) TearDownSuite() {
+ suite.server.Shutdown()
+ suite.alloc.AssertSize(suite.T(), 0)
+}
+
+func (suite *ConnectionTests) TestGetInfo() {
+ reader, err := suite.Cnxn.GetInfo(suite.ctx, []adbc.InfoCode{})
+ // Should not error, even though server does not implement GetInfo
+ suite.Require().NoError(err)
Review Comment:
Will do
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org