Skip to content

Commit

Permalink
parallelize TestLongData
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Dec 12, 2023
1 parent 2242274 commit a360be7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions driver_test.go
Expand Up @@ -1241,7 +1241,7 @@ func TestUint64(t *testing.T) {
}

func TestLongData(t *testing.T) {
runTests(t, dsn+"&maxAllowedPacket=0", func(dbt *DBTest) {
runTestsParallel(t, dsn+"&maxAllowedPacket=0", func(dbt *DBTest, tbl string) {
var maxAllowedPacketSize int
err := dbt.db.QueryRow("select @@max_allowed_packet").Scan(&maxAllowedPacketSize)
if err != nil {
Expand All @@ -1254,7 +1254,7 @@ func TestLongData(t *testing.T) {
maxAllowedPacketSize = 1 << 25
}

dbt.mustExec("CREATE TABLE test (value LONGBLOB)")
dbt.mustExec("CREATE TABLE " + tbl + " (value LONGBLOB)")

in := strings.Repeat(`a`, maxAllowedPacketSize+1)
var out string
Expand All @@ -1263,8 +1263,8 @@ func TestLongData(t *testing.T) {
// Long text data
const nonDataQueryLen = 28 // length query w/o value
inS := in[:maxAllowedPacketSize-nonDataQueryLen]
dbt.mustExec("INSERT INTO test VALUES('" + inS + "')")
rows = dbt.mustQuery("SELECT value FROM test")
dbt.mustExec("INSERT INTO " + tbl + " VALUES('" + inS + "')")
rows = dbt.mustQuery("SELECT value FROM " + tbl)
defer rows.Close()
if rows.Next() {
rows.Scan(&out)
Expand All @@ -1279,11 +1279,11 @@ func TestLongData(t *testing.T) {
}

// Empty table
dbt.mustExec("TRUNCATE TABLE test")
dbt.mustExec("TRUNCATE TABLE " + tbl)

// Long binary data
dbt.mustExec("INSERT INTO test VALUES(?)", in)
rows = dbt.mustQuery("SELECT value FROM test WHERE 1=?", 1)
dbt.mustExec("INSERT INTO "+tbl+" VALUES(?)", in)
rows = dbt.mustQuery("SELECT value FROM "+tbl+" WHERE 1=?", 1)
defer rows.Close()
if rows.Next() {
rows.Scan(&out)
Expand Down

0 comments on commit a360be7

Please sign in to comment.