Commit e5e54a83 authored by gwenn's avatar gwenn

Try to fix Travis build

parent a23f901d
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"context" "context"
"database/sql" "database/sql"
"math/rand" "math/rand"
"strconv"
"testing" "testing"
"time" "time"
...@@ -422,24 +423,27 @@ func _TestPreparedStmt(t *testing.T) { ...@@ -422,24 +423,27 @@ func _TestPreparedStmt(t *testing.T) {
} }
func TestCancel(t *testing.T) { func TestCancel(t *testing.T) {
db := sqlOpen(t) db := sqlCreate(ddl, t)
defer checkSqlDbClose(db, t) defer checkSqlDbClose(db, t)
/*conn := sqlite.Unwrap(db)
for i := 0; i < 40; i++ {
_, err := db.Exec(insert, "Bart "+strconv.Itoa(i))
checkNoError(t, err, "Error updating data: %s")
}
conn := sqlite.Unwrap(db)
assert.Tf(t, conn != nil, "got %#v; want *sqlite.Conn", conn) assert.Tf(t, conn != nil, "got %#v; want *sqlite.Conn", conn)
conn.CreateScalarFunction("sleep", 0, false, nil, func(ctx *sqlite.ScalarContext, nArg int) { conn.CreateScalarFunction("sleep", 0, false, nil, func(ctx *sqlite.ScalarContext, nArg int) {
time.Sleep(500 * time.Millisecond) time.Sleep(5 * time.Millisecond)
ctx.ResultText("ok") ctx.ResultText("ok")
}, nil)*/ }, nil)
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
go func() { go func() {
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
cancel() cancel()
}() }()
_, err := db.ExecContext(ctx, ` _, err := db.ExecContext(ctx, "SELECT sleep() FROM test")
WITH RECURSIVE
cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000000)
SELECT x FROM cnt;`)
if err != context.Canceled { if err != context.Canceled {
t.Errorf("ExecContext expected to fail with Cancelled but it returned %v", err) t.Errorf("ExecContext expected to fail with Cancelled but it returned %v", err)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment