@@ -153,7 +153,7 @@ func TestAuthority_SignSSH(t *testing.T) {
153
153
a .sshCAUserCertSignKey = tt .fields .sshCAUserCertSignKey
154
154
a .sshCAHostCertSignKey = tt .fields .sshCAHostCertSignKey
155
155
156
- got , err := a .SignSSH (tt .args .key , tt .args .opts , tt .args .signOpts ... )
156
+ got , err := a .SignSSH (context . Background (), tt .args .key , tt .args .opts , tt .args .signOpts ... )
157
157
if (err != nil ) != tt .wantErr {
158
158
t .Errorf ("Authority.SignSSH() error = %v, wantErr %v" , err , tt .wantErr )
159
159
return
@@ -242,7 +242,7 @@ func TestAuthority_SignSSHAddUser(t *testing.T) {
242
242
AddUserPrincipal : tt .fields .addUserPrincipal ,
243
243
AddUserCommand : tt .fields .addUserCommand ,
244
244
}
245
- got , err := a .SignSSHAddUser (tt .args .key , tt .args .subject )
245
+ got , err := a .SignSSHAddUser (context . Background (), tt .args .key , tt .args .subject )
246
246
if (err != nil ) != tt .wantErr {
247
247
t .Errorf ("Authority.SignSSHAddUser() error = %v, wantErr %v" , err , tt .wantErr )
248
248
return
@@ -295,7 +295,7 @@ func TestAuthority_GetSSHRoots(t *testing.T) {
295
295
a .sshCAUserCerts = tt .fields .sshCAUserCerts
296
296
a .sshCAHostCerts = tt .fields .sshCAHostCerts
297
297
298
- got , err := a .GetSSHRoots ()
298
+ got , err := a .GetSSHRoots (context . Background () )
299
299
if (err != nil ) != tt .wantErr {
300
300
t .Errorf ("Authority.GetSSHRoots() error = %v, wantErr %v" , err , tt .wantErr )
301
301
return
@@ -337,7 +337,7 @@ func TestAuthority_GetSSHFederation(t *testing.T) {
337
337
a .sshCAUserFederatedCerts = tt .fields .sshCAUserFederatedCerts
338
338
a .sshCAHostFederatedCerts = tt .fields .sshCAHostFederatedCerts
339
339
340
- got , err := a .GetSSHFederation ()
340
+ got , err := a .GetSSHFederation (context . Background () )
341
341
if (err != nil ) != tt .wantErr {
342
342
t .Errorf ("Authority.GetSSHFederation() error = %v, wantErr %v" , err , tt .wantErr )
343
343
return
@@ -463,7 +463,7 @@ func TestAuthority_GetSSHConfig(t *testing.T) {
463
463
a .sshCAUserCertSignKey = tt .fields .userSigner
464
464
a .sshCAHostCertSignKey = tt .fields .hostSigner
465
465
466
- got , err := a .GetSSHConfig (tt .args .typ , tt .args .data )
466
+ got , err := a .GetSSHConfig (context . Background (), tt .args .typ , tt .args .data )
467
467
if (err != nil ) != tt .wantErr {
468
468
t .Errorf ("Authority.GetSSHConfig() error = %v, wantErr %v" , err , tt .wantErr )
469
469
return
@@ -614,7 +614,7 @@ func TestAuthority_GetSSHBastion(t *testing.T) {
614
614
}
615
615
type fields struct {
616
616
config * Config
617
- sshBastionFunc func (user , hostname string ) (* Bastion , error )
617
+ sshBastionFunc func (ctx context. Context , user , hostname string ) (* Bastion , error )
618
618
}
619
619
type args struct {
620
620
user string
@@ -630,8 +630,8 @@ func TestAuthority_GetSSHBastion(t *testing.T) {
630
630
{"config" , fields {& Config {SSH : & SSHConfig {Bastion : bastion }}, nil }, args {"user" , "host.local" }, bastion , false },
631
631
{"nil" , fields {& Config {SSH : & SSHConfig {Bastion : nil }}, nil }, args {"user" , "host.local" }, nil , false },
632
632
{"empty" , fields {& Config {SSH : & SSHConfig {Bastion : & Bastion {}}}, nil }, args {"user" , "host.local" }, nil , false },
633
- {"func" , fields {& Config {}, func (_ , _ string ) (* Bastion , error ) { return bastion , nil }}, args {"user" , "host.local" }, bastion , false },
634
- {"func err" , fields {& Config {}, func (_ , _ string ) (* Bastion , error ) { return nil , errors .New ("foo" ) }}, args {"user" , "host.local" }, nil , true },
633
+ {"func" , fields {& Config {}, func (_ context. Context , _ , _ string ) (* Bastion , error ) { return bastion , nil }}, args {"user" , "host.local" }, bastion , false },
634
+ {"func err" , fields {& Config {}, func (_ context. Context , _ , _ string ) (* Bastion , error ) { return nil , errors .New ("foo" ) }}, args {"user" , "host.local" }, nil , true },
635
635
{"error" , fields {& Config {SSH : nil }, nil }, args {"user" , "host.local" }, nil , true },
636
636
}
637
637
for _ , tt := range tests {
@@ -640,7 +640,7 @@ func TestAuthority_GetSSHBastion(t *testing.T) {
640
640
config : tt .fields .config ,
641
641
sshBastionFunc : tt .fields .sshBastionFunc ,
642
642
}
643
- got , err := a .GetSSHBastion (tt .args .user , tt .args .hostname )
643
+ got , err := a .GetSSHBastion (context . Background (), tt .args .user , tt .args .hostname )
644
644
if (err != nil ) != tt .wantErr {
645
645
t .Errorf ("Authority.GetSSHBastion() error = %v, wantErr %v" , err , tt .wantErr )
646
646
return
@@ -659,7 +659,7 @@ func TestAuthority_GetSSHHosts(t *testing.T) {
659
659
a := testAuthority (t )
660
660
661
661
type test struct {
662
- getHostsFunc func (* x509.Certificate ) ([]sshutil.Host , error )
662
+ getHostsFunc func (context. Context , * x509.Certificate ) ([]sshutil.Host , error )
663
663
auth * Authority
664
664
cert * x509.Certificate
665
665
cmp func (got []sshutil.Host )
@@ -669,7 +669,7 @@ func TestAuthority_GetSSHHosts(t *testing.T) {
669
669
tests := map [string ]func (t * testing.T ) * test {
670
670
"fail/getHostsFunc-fail" : func (t * testing.T ) * test {
671
671
return & test {
672
- getHostsFunc : func (cert * x509.Certificate ) ([]sshutil.Host , error ) {
672
+ getHostsFunc : func (ctx context. Context , cert * x509.Certificate ) ([]sshutil.Host , error ) {
673
673
return nil , errors .New ("force" )
674
674
},
675
675
cert : & x509.Certificate {},
@@ -684,7 +684,7 @@ func TestAuthority_GetSSHHosts(t *testing.T) {
684
684
}
685
685
686
686
return & test {
687
- getHostsFunc : func (cert * x509.Certificate ) ([]sshutil.Host , error ) {
687
+ getHostsFunc : func (ctx context. Context , cert * x509.Certificate ) ([]sshutil.Host , error ) {
688
688
return hosts , nil
689
689
},
690
690
cert : & x509.Certificate {},
@@ -732,7 +732,7 @@ func TestAuthority_GetSSHHosts(t *testing.T) {
732
732
}
733
733
auth .sshGetHostsFunc = tc .getHostsFunc
734
734
735
- hosts , err := auth .GetSSHHosts (tc .cert )
735
+ hosts , err := auth .GetSSHHosts (context . Background (), tc .cert )
736
736
if err != nil {
737
737
if assert .NotNil (t , tc .err ) {
738
738
sc , ok := err .(errs.StatusCoder )
@@ -901,7 +901,7 @@ func TestAuthority_RekeySSH(t *testing.T) {
901
901
a .sshCAUserCertSignKey = tc .userSigner
902
902
a .sshCAHostCertSignKey = tc .hostSigner
903
903
904
- cert , err := auth .RekeySSH (tc .cert , tc .key , tc .signOpts ... )
904
+ cert , err := auth .RekeySSH (context . Background (), tc .cert , tc .key , tc .signOpts ... )
905
905
if err != nil {
906
906
if assert .NotNil (t , tc .err ) {
907
907
sc , ok := err .(errs.StatusCoder )
0 commit comments