Added a check to ensure clientTLS configuration contains either a cert or a key
This commit is contained in:
parent
87e6285cf6
commit
98dfd2ba0e
2 changed files with 55 additions and 15 deletions
|
@ -197,6 +197,40 @@ func TestNilClientTLS(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestInsecureSkipVerifyClientTLS(t *testing.T) {
|
||||
provider := &myProvider{
|
||||
BaseProvider{
|
||||
Filename: "",
|
||||
},
|
||||
&ClientTLS{
|
||||
InsecureSkipVerify: true,
|
||||
},
|
||||
}
|
||||
config, err := provider.TLS.CreateTLSConfig()
|
||||
if err != nil {
|
||||
t.Fatal("CreateTLSConfig should assume that consumer does not want a TLS configuration if input is nil")
|
||||
}
|
||||
if !config.InsecureSkipVerify {
|
||||
t.Fatal("CreateTLSConfig should support setting only InsecureSkipVerify property")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInsecureSkipVerifyFalseClientTLS(t *testing.T) {
|
||||
provider := &myProvider{
|
||||
BaseProvider{
|
||||
Filename: "",
|
||||
},
|
||||
&ClientTLS{
|
||||
InsecureSkipVerify: false,
|
||||
},
|
||||
}
|
||||
_, err := provider.TLS.CreateTLSConfig()
|
||||
if err == nil {
|
||||
t.Fatal("CreateTLSConfig should error if consumer does not set a TLS cert or key configuration and not chooses InsecureSkipVerify to be true")
|
||||
}
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
func TestMatchingConstraints(t *testing.T) {
|
||||
cases := []struct {
|
||||
constraints types.Constraints
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue