Skip to content

Commit

Permalink
Adjust test for benchmarking copy to MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
murfffi committed Dec 3, 2024
1 parent 2e5d24c commit d2f10e6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions drivers/drivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"regexp"
"strings"
"testing"
"time"

dt "github.com/ory/dockertest/v3"
dc "github.com/ory/dockertest/v3/docker"
Expand Down Expand Up @@ -426,7 +425,10 @@ func TestCopy(t *testing.T) {
// setup test data, ignoring errors, since there'll be duplicates
_, _ = pg.DB.Exec("ALTER TABLE staff DROP CONSTRAINT staff_address_id_fkey")
_, _ = pg.DB.Exec("ALTER TABLE staff DROP CONSTRAINT staff_store_id_fkey")
_, _ = pg.DB.Exec("INSERT INTO staff VALUES (1, 'John', 'Doe', 1, '[email protected]', 1, true, 'jdoe', 'abc', now(), 'abcd')")
_, _ = pg.DB.Exec(`
INSERT INTO staff (first_name, last_name, address_id, email, store_id, active, username, password, last_update)
SELECT 'John', 'Doe', 1, '[email protected]', 1, true, 'jdoe', 'abc', now() FROM generate_series(1,1000000)
`)

type setupQuery struct {
query string
Expand Down Expand Up @@ -542,9 +544,11 @@ func TestCopy(t *testing.T) {
t.Fatalf("Could not get rows to copy: %v", err)
}

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
var rlen int64 = 1
//ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
//defer cancel()
ctx := context.Background()

var rlen int64 = 1000000
n, err := drivers.Copy(ctx, db.URL, nil, nil, rows, test.dest)
if err != nil {
t.Fatalf("Could not copy: %v", err)
Expand Down

0 comments on commit d2f10e6

Please sign in to comment.