15
15
package apply
16
16
17
17
import (
18
- "context"
19
18
"errors"
20
19
"testing"
21
20
"time"
@@ -437,12 +436,10 @@ func TestAuthApplierV3_Put(t *testing.T) {
437
436
438
437
authApplier := defaultAuthApplierV3 (t )
439
438
mustCreateRolesAndEnableAuth (t , authApplier )
440
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
441
- defer cancel ()
442
439
for _ , tc := range tcs {
443
440
t .Run (tc .name , func (t * testing.T ) {
444
441
setAuthInfo (authApplier , tc .userName )
445
- _ , _ , err := authApplier .Put (ctx , tc .request )
442
+ _ , _ , err := authApplier .Put (tc .request )
446
443
require .Equalf (t , tc .expectError , err , "Put returned unexpected error (or lack thereof), expected: %v, got: %v" , tc .expectError , err )
447
444
})
448
445
}
@@ -452,8 +449,6 @@ func TestAuthApplierV3_Put(t *testing.T) {
452
449
func TestAuthApplierV3_LeasePut (t * testing.T ) {
453
450
authApplier := defaultAuthApplierV3 (t )
454
451
mustCreateRolesAndEnableAuth (t , authApplier )
455
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
456
- defer cancel ()
457
452
458
453
_ , err := authApplier .LeaseGrant (& pb.LeaseGrantRequest {
459
454
TTL : lease .MaxLeaseTTL ,
@@ -463,7 +458,7 @@ func TestAuthApplierV3_LeasePut(t *testing.T) {
463
458
464
459
// The user should be able to put the key
465
460
setAuthInfo (authApplier , userWriteOnly )
466
- _ , _ , err = authApplier .Put (ctx , & pb.PutRequest {
461
+ _ , _ , err = authApplier .Put (& pb.PutRequest {
467
462
Key : []byte (key ),
468
463
Value : []byte ("1" ),
469
464
Lease : leaseID ,
@@ -472,7 +467,7 @@ func TestAuthApplierV3_LeasePut(t *testing.T) {
472
467
473
468
// Put a key under the lease outside user's key range
474
469
setAuthInfo (authApplier , userRoot )
475
- _ , _ , err = authApplier .Put (ctx , & pb.PutRequest {
470
+ _ , _ , err = authApplier .Put (& pb.PutRequest {
476
471
Key : []byte (keyOutsideRange ),
477
472
Value : []byte ("1" ),
478
473
Lease : leaseID ,
@@ -481,7 +476,7 @@ func TestAuthApplierV3_LeasePut(t *testing.T) {
481
476
482
477
// The user should not be able to put the key anymore
483
478
setAuthInfo (authApplier , userWriteOnly )
484
- _ , _ , err = authApplier .Put (ctx , & pb.PutRequest {
479
+ _ , _ , err = authApplier .Put (& pb.PutRequest {
485
480
Key : []byte (key ),
486
481
Value : []byte ("1" ),
487
482
Lease : leaseID ,
@@ -524,12 +519,10 @@ func TestAuthApplierV3_Range(t *testing.T) {
524
519
525
520
authApplier := defaultAuthApplierV3 (t )
526
521
mustCreateRolesAndEnableAuth (t , authApplier )
527
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
528
- defer cancel ()
529
522
for _ , tc := range tcs {
530
523
t .Run (tc .name , func (t * testing.T ) {
531
524
setAuthInfo (authApplier , tc .userName )
532
- _ , _ , err := authApplier .Range (ctx , tc .request )
525
+ _ , _ , err := authApplier .Range (tc .request )
533
526
require .Equalf (t , tc .expectError , err , "Range returned unexpected error (or lack thereof), expected: %v, got: %v" , tc .expectError , err )
534
527
})
535
528
}
@@ -593,7 +586,7 @@ func TestAuthApplierV3_DeleteRange(t *testing.T) {
593
586
for _ , tc := range tcs {
594
587
t .Run (tc .name , func (t * testing.T ) {
595
588
setAuthInfo (authApplier , tc .userName )
596
- _ , _ , err := authApplier .DeleteRange (context . Background (), tc .request )
589
+ _ , _ , err := authApplier .DeleteRange (tc .request )
597
590
require .Equalf (t , tc .expectError , err , "Range returned unexpected error (or lack thereof), expected: %v, got: %v" , tc .expectError , err )
598
591
})
599
592
}
@@ -660,12 +653,10 @@ func TestAuthApplierV3_Txn(t *testing.T) {
660
653
661
654
authApplier := defaultAuthApplierV3 (t )
662
655
mustCreateRolesAndEnableAuth (t , authApplier )
663
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
664
- defer cancel ()
665
656
for _ , tc := range tcs {
666
657
t .Run (tc .name , func (t * testing.T ) {
667
658
setAuthInfo (authApplier , tc .userName )
668
- _ , _ , err := authApplier .Txn (ctx , tc .request )
659
+ _ , _ , err := authApplier .Txn (tc .request )
669
660
require .Equalf (t , tc .expectError , err , "Range returned unexpected error (or lack thereof), expected: %v, got: %v" , tc .expectError , err )
670
661
})
671
662
}
@@ -676,8 +667,6 @@ func TestAuthApplierV3_Txn(t *testing.T) {
676
667
func TestAuthApplierV3_LeaseRevoke (t * testing.T ) {
677
668
authApplier := defaultAuthApplierV3 (t )
678
669
mustCreateRolesAndEnableAuth (t , authApplier )
679
- ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
680
- defer cancel ()
681
670
682
671
_ , err := authApplier .LeaseGrant (& pb.LeaseGrantRequest {
683
672
TTL : lease .MaxLeaseTTL ,
@@ -700,7 +689,7 @@ func TestAuthApplierV3_LeaseRevoke(t *testing.T) {
700
689
701
690
// Put a key under the lease outside user's key range
702
691
setAuthInfo (authApplier , userRoot )
703
- _ , _ , err = authApplier .Put (ctx , & pb.PutRequest {
692
+ _ , _ , err = authApplier .Put (& pb.PutRequest {
704
693
Key : []byte (keyOutsideRange ),
705
694
Value : []byte ("1" ),
706
695
Lease : leaseID ,
0 commit comments