Add test to check for connection to invalid server.
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/d761d38d Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/tree/d761d38d Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/diff/d761d38d Branch: refs/heads/master Commit: d761d38d0c394c97de9b29ffc13aeabc9a6bdd72 Parents: ed76748 Author: Francis Chuang <francis.chu...@gmail.com> Authored: Tue May 31 20:50:35 2016 +1000 Committer: Julian Hyde <jh...@apache.org> Committed: Thu Aug 10 18:47:08 2017 -0700 ---------------------------------------------------------------------- driver_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/d761d38d/driver_test.go ---------------------------------------------------------------------- diff --git a/driver_test.go b/driver_test.go index d1dca9b..a91f137 100644 --- a/driver_test.go +++ b/driver_test.go @@ -824,8 +824,6 @@ func TestLastInsertIDShouldReturnError(t *testing.T) { runTests(t, dsn, func(dbt *DBTest) { - // Create and seed table - dbt.mustExec(`DROP SEQUENCE IF EXISTS test.test_sequence`) dbt.mustExec(`CREATE TABLE ` + dbt.tableName + ` ( @@ -851,3 +849,18 @@ func TestLastInsertIDShouldReturnError(t *testing.T) { } }) } + +func TestConnectionToInvalidServerShouldReturnError(t *testing.T) { + + runTests(t, "http://invalid-server:8765", func(dbt *DBTest) { + + _, err := dbt.db.Exec(`CREATE TABLE ` + dbt.tableName + ` ( + id INTEGER PRIMARY KEY, + msg VARCHAR, + ) TRANSACTIONAL=true`) + + if err == nil { + dbt.Fatal("Expected an error due to connection to invalid server, but got nothing.") + } + }) +}