FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix test case for mock · developgo/CovenantSQL@ccc6359 · GitHub

Commit ccc6359

Browse files
Qi Xiao
committed
Fix test case for mock
1 parent 1f9cef2 commit ccc6359

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎client/driver_test.go‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"testing"
2424
"time"
2525

26+
bp "github.com/CovenantSQL/CovenantSQL/blockproducer"
2627
"github.com/CovenantSQL/CovenantSQL/crypto"
2728
"github.com/CovenantSQL/CovenantSQL/crypto/asymmetric"
2829
"github.com/CovenantSQL/CovenantSQL/crypto/kms"
@@ -68,10 +69,13 @@ func TestCreate(t *testing.T) {
6869
var dsn string
6970
dsn, err = Create(ResourceMeta{})
7071
So(err, ShouldBeNil)
72+
dsnCfg, err := ParseDSN(dsn)
73+
So(err, ShouldBeNil)
7174

7275
waitCtx, cancelWait := context.WithTimeout(context.Background(), time.Nanosecond)
7376
defer cancelWait()
74-
err = WaitDBCreation(waitCtx, dsn)
77+
// should not use client.WaitDBCreation, sql.Open is not supported in this test case
78+
err = bp.WaitDatabaseCreation(waitCtx, proto.DatabaseID(dsnCfg.DatabaseID), nil, 3*time.Second)
7579
So(err, ShouldResemble, context.DeadlineExceeded)
7680

7781
// Calculate database ID
@@ -92,7 +96,8 @@ func TestCreate(t *testing.T) {
9296

9397
waitCtx2, cancelWait2 := context.WithTimeout(context.Background(), 5*time.Minute)
9498
defer cancelWait2()
95-
err = WaitDBCreation(waitCtx2, dsn)
99+
// should not use client.WaitDBCreation, sql.Open is not supported in this test case
100+
err = bp.WaitDatabaseCreation(waitCtx2, proto.DatabaseID(dsnCfg.DatabaseID), nil, 3*time.Second)
96101
So(err, ShouldBeNil)
97102
})
98103
}

‎cmd/cql-observer/observation_test.go‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,6 @@ func TestFullProcess(t *testing.T) {
304304
err = client.WaitDBCreation(ctx2, dsn)
305305
So(err, ShouldBeNil)
306306

307-
_, err = db.ExecContext(ctx2, "SHOW TABLES")
308-
So(err, ShouldBeNil)
309-
310307
_, err = db.Exec("CREATE TABLE test (test int)")
311308
So(err, ShouldBeNil)
312309

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL