@@ -48,7 +48,7 @@ func CreateScyllaManagerDBSession(tb testing.TB) gocqlx.Session {
4848 session := createSessionFromCluster (tb , cluster )
4949
5050 migrate .Callback = nopmigrate .Callback
51- if err := migrate .FromFS (context . Background (), session , schema .Files ); err != nil {
51+ if err := migrate .FromFS (tb . Context (), session , schema .Files ); err != nil {
5252 tb .Fatal ("migrate:" , err )
5353 }
5454 return session
@@ -83,9 +83,8 @@ func CreateSession(tb testing.TB, client *scyllaclient.Client) gocqlx.Session {
8383// It allows to specify cql user and decide if cluster should be cleared.
8484func CreateManagedClusterSession (tb testing.TB , empty bool , client * scyllaclient.Client , user , pass string ) gocqlx.Session {
8585 tb .Helper ()
86- ctx := context .Background ()
8786
88- sessionHosts , err := cluster .GetRPCAddresses (ctx , client , client .Config ().Hosts , false )
87+ sessionHosts , err := cluster .GetRPCAddresses (tb . Context () , client , client .Config ().Hosts , false )
8988 if err != nil {
9089 tb .Log (err )
9190 if errors .Is (err , cluster .ErrNoRPCAddressesFound ) {
@@ -279,7 +278,7 @@ func FlushTable(t *testing.T, client *scyllaclient.Client, hosts []string, keysp
279278 t .Helper ()
280279
281280 for _ , h := range hosts {
282- if err := client .FlushTable (context . Background (), h , keyspace , table ); err != nil {
281+ if err := client .FlushTable (t . Context (), h , keyspace , table ); err != nil {
283282 t .Fatal (err )
284283 }
285284 }
@@ -352,7 +351,7 @@ func GetAlternatorCreds(t *testing.T, s gocqlx.Session, role string) (accessKeyI
352351func CreateAlternatorClient (t * testing.T , client * scyllaclient.Client , host , accessKeyID , secretAccessKey string ) * dynamodb.Client {
353352 t .Helper ()
354353
355- ni , err := client .NodeInfo (context . Background (), host )
354+ ni , err := client .NodeInfo (t . Context (), host )
356355 if err != nil {
357356 t .Fatal (err )
358357 }
@@ -471,7 +470,7 @@ func CreateAlternatorTable(t *testing.T, client *dynamodb.Client, lsiCnt, gsiCnt
471470 }
472471
473472 for _ , table := range tables {
474- _ , err := client .CreateTable (context . Background (), & dynamodb.CreateTableInput {
473+ _ , err := client .CreateTable (t . Context (), & dynamodb.CreateTableInput {
475474 TableName : aws .String (table ),
476475 AttributeDefinitions : attrDef ,
477476 KeySchema : []types.KeySchemaElement {
@@ -499,7 +498,7 @@ func CreateAlternatorGSI(t *testing.T, client *dynamodb.Client, table string, gs
499498 t .Helper ()
500499
501500 for _ , gsi := range gsis {
502- _ , err := client .UpdateTable (context . Background (), & dynamodb.UpdateTableInput {
501+ _ , err := client .UpdateTable (t . Context (), & dynamodb.UpdateTableInput {
503502 TableName : aws .String (table ),
504503 AttributeDefinitions : []types.AttributeDefinition {
505504 {
@@ -542,14 +541,14 @@ func CreateAlternatorGSI(t *testing.T, client *dynamodb.Client, table string, gs
542541func TagAlternatorTable (t * testing.T , client * dynamodb.Client , table string , tags ... string ) {
543542 t .Helper ()
544543
545- out , err := client .DescribeTable (context . Background (), & dynamodb.DescribeTableInput {
544+ out , err := client .DescribeTable (t . Context (), & dynamodb.DescribeTableInput {
546545 TableName : aws .String (table ),
547546 })
548547 if err != nil {
549548 t .Fatal (err )
550549 }
551550
552- _ , err = client .TagResource (context . Background (), & dynamodb.TagResourceInput {
551+ _ , err = client .TagResource (t . Context (), & dynamodb.TagResourceInput {
553552 ResourceArn : out .Table .TableArn ,
554553 Tags : slices2 .Map (tags , func (tag string ) types.Tag {
555554 return types.Tag {
@@ -567,7 +566,7 @@ func TagAlternatorTable(t *testing.T, client *dynamodb.Client, table string, tag
567566func UpdateAlternatorTableTTL (t * testing.T , client * dynamodb.Client , table , attr string , enabled bool ) {
568567 t .Helper ()
569568
570- _ , err := client .UpdateTimeToLive (context . Background (), & dynamodb.UpdateTimeToLiveInput {
569+ _ , err := client .UpdateTimeToLive (t . Context (), & dynamodb.UpdateTimeToLiveInput {
571570 TableName : aws .String (table ),
572571 TimeToLiveSpecification : & types.TimeToLiveSpecification {
573572 AttributeName : aws .String (attr ),
@@ -611,7 +610,7 @@ func InsertAlternatorTableData(t *testing.T, client *dynamodb.Client, rowCnt int
611610 table : writeRequests ,
612611 },
613612 }
614- _ , err := client .BatchWriteItem (context . Background (), in )
613+ _ , err := client .BatchWriteItem (t . Context (), in )
615614 if err != nil {
616615 t .Fatal (err )
617616 }
@@ -624,7 +623,7 @@ func ValidateAlternatorTableData(t *testing.T, client *dynamodb.Client, rowCnt,
624623 t .Helper ()
625624
626625 for _ , table := range tables {
627- out , err := client .Scan (context . Background (), & dynamodb.ScanInput {
626+ out , err := client .Scan (t . Context (), & dynamodb.ScanInput {
628627 TableName : aws .String (table ),
629628 })
630629 if err != nil {
@@ -635,7 +634,7 @@ func ValidateAlternatorTableData(t *testing.T, client *dynamodb.Client, rowCnt,
635634 }
636635
637636 for lsi := range lsiCnt {
638- out , err = client .Scan (context . Background (), & dynamodb.ScanInput {
637+ out , err = client .Scan (t . Context (), & dynamodb.ScanInput {
639638 TableName : aws .String (table ),
640639 IndexName : aws .String (fmt .Sprint (AlternatorLSIPrefix , lsi )),
641640 })
@@ -648,7 +647,7 @@ func ValidateAlternatorTableData(t *testing.T, client *dynamodb.Client, rowCnt,
648647 }
649648
650649 for gsi := range gsiCnt {
651- out , err = client .Scan (context . Background (), & dynamodb.ScanInput {
650+ out , err = client .Scan (t . Context (), & dynamodb.ScanInput {
652651 TableName : aws .String (table ),
653652 IndexName : aws .String (fmt .Sprint (AlternatorGSIPrefix , gsi )),
654653 })
@@ -667,7 +666,7 @@ func ValidateAlternatorGSIData(t *testing.T, client *dynamodb.Client, rowCnt int
667666 t .Helper ()
668667
669668 for _ , gsi := range gsis {
670- out , err := client .Scan (context . Background (), & dynamodb.ScanInput {
669+ out , err := client .Scan (t . Context (), & dynamodb.ScanInput {
671670 TableName : aws .String (table ),
672671 IndexName : aws .String (gsi ),
673672 })
0 commit comments