Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddtmachado authored and rtribotte committed May 18, 2022
1 parent 894335b commit df40e04
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 71 deletions.
32 changes: 4 additions & 28 deletions pkg/server/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,7 @@ func Test_mergeConfiguration_tlsOptions(t *testing.T) {
desc: "Nil returns an empty configuration",
given: nil,
expected: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
},
{
Expand All @@ -205,13 +199,7 @@ func Test_mergeConfiguration_tlsOptions(t *testing.T) {
},
},
expected: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
"foo@provider-1": {
MinVersion: "VersionTLS12",
},
Expand Down Expand Up @@ -240,13 +228,7 @@ func Test_mergeConfiguration_tlsOptions(t *testing.T) {
},
},
expected: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
"foo@provider-1": {
MinVersion: "VersionTLS13",
},
Expand Down Expand Up @@ -352,13 +334,7 @@ func Test_mergeConfiguration_tlsOptions(t *testing.T) {
},
},
expected: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
"foo@provider-1": {
MinVersion: "VersionTLS12",
},
Expand Down
48 changes: 6 additions & 42 deletions pkg/server/configurationwatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,7 @@ func TestNewConfigurationWatcher(t *testing.T) {
},
TLS: &dynamic.TLSConfiguration{
Options: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
Stores: map[string]tls.Store{},
},
Expand Down Expand Up @@ -238,13 +232,7 @@ func TestIgnoreTransientConfiguration(t *testing.T) {
},
TLS: &dynamic.TLSConfiguration{
Options: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
Stores: map[string]tls.Store{},
},
Expand Down Expand Up @@ -408,13 +396,7 @@ func TestListenProvidersDoesNotSkipFlappingConfiguration(t *testing.T) {
},
TLS: &dynamic.TLSConfiguration{
Options: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
Stores: map[string]tls.Store{},
},
Expand Down Expand Up @@ -503,13 +485,7 @@ func TestListenProvidersIgnoreSameConfig(t *testing.T) {
},
TLS: &dynamic.TLSConfiguration{
Options: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
Stores: map[string]tls.Store{},
},
Expand Down Expand Up @@ -642,13 +618,7 @@ func TestListenProvidersIgnoreIntermediateConfigs(t *testing.T) {
},
TLS: &dynamic.TLSConfiguration{
Options: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
Stores: map[string]tls.Store{},
},
Expand Down Expand Up @@ -710,13 +680,7 @@ func TestListenProvidersPublishesConfigForEachProvider(t *testing.T) {
},
TLS: &dynamic.TLSConfiguration{
Options: map[string]tls.Options{
"default": {
ALPNProtocols: []string{
"h2",
"http/1.1",
"acme-tls/1",
},
},
"default": tls.DefaultTLSOptions,
},
Stores: map[string]tls.Store{},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/tls/tlsmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var DefaultTLSOptions = Options{
func goSecureCiphers() []string {
gsc := tls.CipherSuites()
ciphers := make([]string, len(gsc))
for idx, cs := range tls.CipherSuites() {
for idx, cs := range gsc {
ciphers[idx] = cs.Name
}
return ciphers
Expand Down

0 comments on commit df40e04

Please sign in to comment.