Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go/test/endtoend/cluster/cluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (tablet *Vttablet) ValidateTabletRestart(t *testing.T) {

// GetPrimaryPosition gets the executed replication position of given vttablet
func GetPrimaryPosition(t *testing.T, vttablet Vttablet, hostname string) (string, string) {
ctx := context.Background()
ctx := t.Context()
vtablet := getTablet(vttablet.GrpcPort, hostname)
pos, err := tmClient.PrimaryPosition(ctx, vtablet)
require.Nil(t, err)
Expand All @@ -105,7 +105,7 @@ func GetPrimaryPosition(t *testing.T, vttablet Vttablet, hostname string) (strin

// FullStatus gets the full status from the given tablet.
func FullStatus(t *testing.T, vttablet *Vttablet, hostname string) *replicationdatapb.FullStatus {
ctx := context.Background()
ctx := t.Context()
vtablet := getTablet(vttablet.GrpcPort, hostname)
status, err := tmClient.FullStatus(ctx, vtablet)
require.NoError(t, err)
Expand Down
9 changes: 3 additions & 6 deletions go/test/endtoend/clustertest/add_keyspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ This adds sharded keyspace dynamically in this test only and test sql insert, se
package clustertest

import (
"context"
"fmt"
"testing"

"vitess.io/vitess/go/test/endtoend/utils"

"vitess.io/vitess/go/vt/log"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/utils"
"vitess.io/vitess/go/vt/log"
)

var (
Expand Down Expand Up @@ -71,7 +68,7 @@ func TestAddKeyspace(t *testing.T) {
_ = clusterInstance.VtgateProcess.Setup()
clusterInstance.WaitForTabletsToHealthyInVtgate()

ctx := context.Background()
ctx := t.Context()
vtParams := mysql.ConnParams{
Host: clusterInstance.Hostname,
Port: clusterInstance.VtgateMySQLPort,
Expand Down
6 changes: 2 additions & 4 deletions go/test/endtoend/clustertest/vtgate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ This tests select/insert using the unshared keyspace added in main_test
package clustertest

import (
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -27,16 +26,15 @@ import (
"strings"
"testing"

"vitess.io/vitess/go/test/endtoend/utils"

"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/test/endtoend/utils"
)

func TestVtgateProcess(t *testing.T) {
verifyVtgateVariables(t, clusterInstance.VtgateProcess.VerifyURL)
ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.NoError(t, err)
defer conn.Close()
Expand Down
16 changes: 7 additions & 9 deletions go/test/endtoend/docker/vttestserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ limitations under the License.
package docker

import (
"context"
"fmt"
"os"
"testing"

"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/utils"
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql"

"github.com/stretchr/testify/require"
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/utils"
)

func TestMain(m *testing.M) {
Expand All @@ -54,7 +52,7 @@ func TestUnsharded(t *testing.T) {
err = vtest.waitUntilDockerHealthy(10)
require.NoError(t, err)

ctx := context.Background()
ctx := t.Context()
vttestParams := mysql.ConnParams{
Host: "localhost",
Port: vtest.basePort + 3,
Expand Down Expand Up @@ -83,7 +81,7 @@ func TestSharded(t *testing.T) {
err = vtest.waitUntilDockerHealthy(10)
require.NoError(t, err)

ctx := context.Background()
ctx := t.Context()
vttestParams := mysql.ConnParams{
Host: "localhost",
Port: vtest.basePort + 3,
Expand Down Expand Up @@ -113,7 +111,7 @@ func TestMysqlMaxCons(t *testing.T) {
err = vtest.waitUntilDockerHealthy(10)
require.NoError(t, err)

ctx := context.Background()
ctx := t.Context()
vttestParams := mysql.ConnParams{
Host: "localhost",
Port: vtest.basePort + 3,
Expand Down Expand Up @@ -169,7 +167,7 @@ func TestLargeNumberOfKeyspaces(t *testing.T) {
err = vtest.waitUntilDockerHealthy(15)
require.NoError(t, err)

ctx := context.Background()
ctx := t.Context()
vttestParams := mysql.ConnParams{
Host: "localhost",
Port: vtest.basePort + 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func TestSecureTransport(t *testing.T) {

// 'vtgate client 1' is authorized to access vt_insert_test
setCreds(t, "vtgate-client-1", "vtgate-server")
ctx := context.Background()
ctx := t.Context()
request := getRequest("select * from vt_insert_test")
vc, err := getVitessClient(ctx, grpcAddress)
require.NoError(t, err)
Expand Down
12 changes: 6 additions & 6 deletions go/test/endtoend/messaging/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ create table vitess_message(
`

func TestMessage(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

vtParams := mysql.ConnParams{
Host: "localhost",
Expand Down Expand Up @@ -207,7 +207,7 @@ create table vitess_message3(
`

func TestThreeColMessage(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

vtParams := mysql.ConnParams{
Host: "localhost",
Expand Down Expand Up @@ -300,7 +300,7 @@ var createSpecificStreamingColsMessage = `create table vitess_message4(
) comment 'vitess_message,vt_message_cols=id|msg1,vt_ack_wait=1,vt_purge_after=3,vt_batch_size=2,vt_cache_size=10,vt_poller_interval=1'`

func TestSpecificStreamingColsMessage(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

vtParams := mysql.ConnParams{
Host: "localhost",
Expand Down Expand Up @@ -378,7 +378,7 @@ func TestUnsharded(t *testing.T) {
func TestReparenting(t *testing.T) {
name := "sharded_message"

ctx := context.Background()
ctx := t.Context()
// start grpc connection with vtgate and validate client
// connection counts in tablets
stream, err := VtgateGrpcConn(ctx, clusterInstance)
Expand Down Expand Up @@ -445,7 +445,7 @@ func TestConnection(t *testing.T) {
assertClientCount(t, 0, shard0Primary)
assertClientCount(t, 0, shard1Primary)

ctx := context.Background()
ctx := t.Context()
// first connection with vtgate
stream, err := VtgateGrpcConn(ctx, clusterInstance)
require.Nil(t, err)
Expand Down Expand Up @@ -492,7 +492,7 @@ func TestConnection(t *testing.T) {
}

func testMessaging(t *testing.T, name, ks string) {
ctx := context.Background()
ctx := t.Context()
stream, err := VtgateGrpcConn(ctx, clusterInstance)
require.Nil(t, err)
defer stream.Close()
Expand Down
15 changes: 7 additions & 8 deletions go/test/endtoend/mysqlserver/mysql_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ R442
package mysqlserver

import (
"context"
"database/sql"
"fmt"
"io"
Expand All @@ -41,7 +40,7 @@ import (

// TestMultiStmt checks that multiStatements=True and multiStatements=False work properly.
func TestMultiStatement(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

// connect database with multiStatements=True
db := connectDB(t, vtParams, "multiStatements=True", "timeout=90s", "collation=utf8mb4_unicode_ci")
Expand All @@ -68,7 +67,7 @@ func TestMultiStatement(t *testing.T) {

// TestLargeComment add large comment in insert stmt and validate the insert process.
func TestLargeComment(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

conn, err := mysql.Connect(ctx, &vtParams)
require.Nilf(t, err, "unable to connect mysql: %v", err)
Expand All @@ -86,7 +85,7 @@ func TestLargeComment(t *testing.T) {

// TestInsertLargerThenGrpcLimit insert blob larger then grpc limit and verify the error.
func TestInsertLargerThenGrpcLimit(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

conn, err := mysql.Connect(ctx, &vtParams)
require.Nilf(t, err, "unable to connect mysql: %v", err)
Expand All @@ -104,7 +103,7 @@ func TestInsertLargerThenGrpcLimit(t *testing.T) {

// TestTimeout executes sleep(5) with query_timeout of 1 second, and verifies the error.
func TestTimeout(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

conn, err := mysql.Connect(ctx, &vtParams)
require.Nilf(t, err, "unable to connect mysql: %v", err)
Expand All @@ -119,7 +118,7 @@ func TestTimeout(t *testing.T) {

// TestInvalidField tries to fetch invalid column and verifies the error.
func TestInvalidField(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

conn, err := mysql.Connect(ctx, &vtParams)
require.Nilf(t, err, "unable to connect mysql: %v", err)
Expand All @@ -134,7 +133,7 @@ func TestInvalidField(t *testing.T) {

// TestWarnings validates the behaviour of SHOW WARNINGS.
func TestWarnings(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

conn, err := mysql.Connect(ctx, &vtParams)
require.NoError(t, err)
Expand Down Expand Up @@ -175,7 +174,7 @@ func TestWarnings(t *testing.T) {
// TestSelectWithUnauthorizedUser verifies that an unauthorized user
// is not able to read from the table.
func TestSelectWithUnauthorizedUser(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

tmpVtParam := vtParams
tmpVtParam.Uname = "testuser2"
Expand Down
4 changes: 2 additions & 2 deletions go/test/endtoend/onlineddl/flow/onlineddl_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func TestMain(m *testing.M) {
}

func TestOnlineDDLFlow(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

require.NotNil(t, clusterInstance)
require.NotNil(t, primaryTablet)
Expand Down Expand Up @@ -584,7 +584,7 @@ func initTable(t *testing.T) {
log.Infof("initTable begin")
defer log.Infof("initTable complete")

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand Down
4 changes: 2 additions & 2 deletions go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ func initTable(t *testing.T) {
log.Infof("initTable begin")
defer log.Infof("initTable complete")

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand All @@ -1446,7 +1446,7 @@ func testSelectTableMetrics(t *testing.T) {

log.Infof("%s", writeMetrics.String())

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.NoError(t, err)
defer conn.Close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ func testDeclarative(t *testing.T) {
log.Infof("initTable begin")
defer log.Infof("initTable complete")

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand All @@ -2370,7 +2370,7 @@ func testDeclarative(t *testing.T) {

log.Infof("%s", writeMetrics.String())

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func TestMain(m *testing.M) {
}

func TestVreplMiniStressSchemaChanges(t *testing.T) {
ctx := context.Background()
ctx := t.Context()

shards = clusterInstance.Keyspaces[0].Shards
require.Equal(t, 1, len(shards))
Expand Down Expand Up @@ -286,7 +286,7 @@ func TestVreplMiniStressSchemaChanges(t *testing.T) {
// the vreplication/ALTER TABLE did not corrupt our data and we are happy.
testName := fmt.Sprintf("ALTER TABLE with workload %d/%d", (i + 1), countIterations)
t.Run(testName, func(t *testing.T) {
ctx := context.Background()
ctx := t.Context()
t.Run("create schema", func(t *testing.T) {
testWithInitialSchema(t)
})
Expand Down Expand Up @@ -562,7 +562,7 @@ func initTable(t *testing.T) {
}
})

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand Down Expand Up @@ -598,7 +598,7 @@ func testSelectTableMetrics(t *testing.T) {

log.Infof("%s", writeMetrics.String())

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ func initTable(t *testing.T) {
log.Infof("initTable begin")
defer log.Infof("initTable complete")

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, &vtParams)
require.Nil(t, err)
defer conn.Close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package vreplsuite

import (
"context"
"flag"
"fmt"
"os"
Expand All @@ -27,6 +26,9 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/mysql/config"
"vitess.io/vitess/go/sqltypes"
Expand All @@ -36,9 +38,6 @@ import (
"vitess.io/vitess/go/test/endtoend/cluster"
"vitess.io/vitess/go/test/endtoend/onlineddl"
"vitess.io/vitess/go/test/endtoend/throttler"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

var (
Expand Down Expand Up @@ -386,7 +385,7 @@ func mysqlParams() *mysql.ConnParams {
func mysqlExec(t *testing.T, sql string, expectError string) *sqltypes.Result {
t.Helper()

ctx := context.Background()
ctx := t.Context()
conn, err := mysql.Connect(ctx, mysqlParams())
require.Nil(t, err)
defer conn.Close()
Expand Down
Loading
Loading