Skip to content

Commit

Permalink
Add tests for insecure cipher suite config
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Herrera <rickhl@outlook.com>
  • Loading branch information
rickhlx committed Jun 25, 2024
1 parent 72a8987 commit e0b34d4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,23 @@ func TestMinTLSVersion(t *testing.T) {
})
}

func TestExcludeInsecureCipherSuites(t *testing.T) {

t.Run("test default", func(t *testing.T) {
cfg := new(Config)
if cfg.filterCipherSuites() != nil {
t.Error("No cipher suites should be filtered by default")
}
})
t.Run("test excluded insecure cipher suites", func(t *testing.T) {
cfg := new(Config)
cfg.ExcludeInsecureCipherSuites = true
if cfg.filterCipherSuites() == nil {
t.Error(`Failed to get list of filtered cipher suites`)
}
})
}

type testFormatter struct {
messages map[string]log.Level
}
Expand Down
7 changes: 7 additions & 0 deletions skipper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ func TestOptionsTLSConfig(t *testing.T) {
require.NoError(t, err)
require.Equal(t, uint16(tls.VersionTLS13), c.MinVersion)
require.Equal(t, []tls.Certificate{cert, cert2}, c.Certificates)

// TLS Cipher Suites
o = &Options{CipherSuites: []uint16{1}}
c, err = o.tlsConfig(cr)
require.NoError(t, err)
assert.Equal(t, len(c.CipherSuites), 1)

}

func TestOptionsTLSConfigInvalidPaths(t *testing.T) {
Expand Down

0 comments on commit e0b34d4

Please sign in to comment.