@@ -20,7 +20,10 @@ JtdGRlLmNzYgECAw==
2020func TestGetClientOptions_HTTPToken (t * testing.T ) {
2121 m := & managerImpl {}
2222 secret := map [string ][]byte {"token" : []byte ("my-token" )}
23- opts := m .getClientOptions ("https" , secret )
23+ opts , err := m .getClientOptions ("https" , secret )
24+ if err != nil {
25+ t .Fatalf ("unexpected error: %v" , err )
26+ }
2427 if len (opts ) != 1 {
2528 t .Fatalf ("expected 1 option, got %d" , len (opts ))
2629 }
@@ -29,31 +32,43 @@ func TestGetClientOptions_HTTPToken(t *testing.T) {
2932func TestGetClientOptions_HTTPUsernamePassword (t * testing.T ) {
3033 m := & managerImpl {}
3134 secret := map [string ][]byte {"username" : []byte ("user" ), "password" : []byte ("pass" )}
32- opts := m .getClientOptions ("http" , secret )
35+ opts , err := m .getClientOptions ("http" , secret )
36+ if err != nil {
37+ t .Fatalf ("unexpected error: %v" , err )
38+ }
3339 if len (opts ) != 1 {
3440 t .Fatalf ("expected 1 option, got %d" , len (opts ))
3541 }
3642}
3743
3844func TestGetClientOptions_HTTPEmpty (t * testing.T ) {
3945 m := & managerImpl {}
40- opts := m .getClientOptions ("https" , nil )
46+ opts , err := m .getClientOptions ("https" , nil )
47+ if err != nil {
48+ t .Fatalf ("unexpected error: %v" , err )
49+ }
4150 if opts != nil {
4251 t .Fatalf ("expected nil options, got %v" , opts )
4352 }
4453}
4554
4655func TestGetClientOptions_SSHNoSecret (t * testing.T ) {
4756 m := & managerImpl {}
48- opts := m .getClientOptions (sshScheme , nil )
57+ opts , err := m .getClientOptions (sshScheme , nil )
58+ if err != nil {
59+ t .Fatalf ("unexpected error: %v" , err )
60+ }
4961 if len (opts ) != 1 {
5062 t .Fatalf ("expected 1 option for insecure SSH, got %d" , len (opts ))
5163 }
5264}
5365
5466func TestGetClientOptions_SSHEmptySecret (t * testing.T ) {
5567 m := & managerImpl {}
56- opts := m .getClientOptions (sshScheme , map [string ][]byte {})
68+ opts , err := m .getClientOptions (sshScheme , map [string ][]byte {})
69+ if err != nil {
70+ t .Fatalf ("unexpected error: %v" , err )
71+ }
5772 if len (opts ) != 1 {
5873 t .Fatalf ("expected 1 option for insecure SSH, got %d" , len (opts ))
5974 }
@@ -62,7 +77,10 @@ func TestGetClientOptions_SSHEmptySecret(t *testing.T) {
6277func TestGetClientOptions_SSHWithPrivateKey (t * testing.T ) {
6378 m := & managerImpl {}
6479 secret := map [string ][]byte {"sshPrivateKey" : []byte (testEd25519PrivateKey )}
65- opts := m .getClientOptions (sshScheme , secret )
80+ opts , err := m .getClientOptions (sshScheme , secret )
81+ if err != nil {
82+ t .Fatalf ("unexpected error: %v" , err )
83+ }
6684 if len (opts ) != 1 {
6785 t .Fatalf ("expected 1 option, got %d" , len (opts ))
6886 }
@@ -71,9 +89,9 @@ func TestGetClientOptions_SSHWithPrivateKey(t *testing.T) {
7189func TestGetClientOptions_SSHWithInvalidKey (t * testing.T ) {
7290 m := & managerImpl {}
7391 secret := map [string ][]byte {"sshPrivateKey" : []byte ("not-a-valid-key" )}
74- opts := m .getClientOptions (sshScheme , secret )
75- if opts ! = nil {
76- t .Fatalf ("expected nil options for invalid key, got %v" , opts )
92+ _ , err := m .getClientOptions (sshScheme , secret )
93+ if err = = nil {
94+ t .Fatal ("expected error for invalid SSH key, got nil" )
7795 }
7896}
7997
0 commit comments