From 83210249892cbbda59785340778f7c10a605e8c6 Mon Sep 17 00:00:00 2001 From: go-jet Date: Sat, 20 Jul 2019 11:36:16 +0200 Subject: [PATCH] Test fix. --- tests/chinook_db_test.go | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/chinook_db_test.go b/tests/chinook_db_test.go index 525bbac..550db0b 100644 --- a/tests/chinook_db_test.go +++ b/tests/chinook_db_test.go @@ -246,23 +246,21 @@ ORDER BY "Album.AlbumId"; assert.DeepEqual(t, dest[1], album2) } -//func TestQueryWithContext(t *testing.T) { -// -// ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) -// defer cancel() -// -// dest := []model.Album{} -// -// err := Album. -// CROSS_JOIN(Track). -// CROSS_JOIN(InvoiceLine). -// SELECT(Album.AllColumns, Track.AllColumns, InvoiceLine.AllColumns). -// QueryContext(db, ctx, &dest) -// -// spew.Dump(dest) -// -// assert.Error(t, err, "context deadline exceeded") -//} +func TestQueryWithContext(t *testing.T) { + + ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond) + defer cancel() + + dest := []model.Album{} + + err := Album. + CROSS_JOIN(Track). + CROSS_JOIN(InvoiceLine). + SELECT(Album.AllColumns, Track.AllColumns, InvoiceLine.AllColumns). + QueryContext(ctx, db, &dest) + + assert.Error(t, err, "context deadline exceeded") +} func TestExecWithContext(t *testing.T) {