Skip to content

Commit de5779c

Browse files
committed
use default worker connections constant and remove unessecary tests
1 parent b3f9ff3 commit de5779c

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

internal/controller/state/dataplane/configuration.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ import (
2222
)
2323

2424
const (
25-
wildcardHostname = "~^"
26-
alpineSSLRootCAPath = "/etc/ssl/cert.pem"
27-
defaultErrorLogLevel = "info"
25+
wildcardHostname = "~^"
26+
alpineSSLRootCAPath = "/etc/ssl/cert.pem"
27+
defaultErrorLogLevel = "info"
28+
defaultWorkerConnections = int32(1024)
2829
)
2930

3031
// BuildConfiguration builds the Configuration from the Graph.
@@ -1107,8 +1108,6 @@ func buildLogging(gateway *graph.Gateway) Logging {
11071108
}
11081109

11091110
func buildWorkerConnections(gateway *graph.Gateway) int32 {
1110-
defaultWorkerConnections := int32(1024)
1111-
11121111
if gateway == nil || gateway.EffectiveNginxProxy == nil {
11131112
return defaultWorkerConnections
11141113
}

internal/controller/state/dataplane/configuration_test.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4907,14 +4907,14 @@ func TestBuildWorkerConnections(t *testing.T) {
49074907
{
49084908
msg: "NginxProxy is nil",
49094909
gw: &graph.Gateway{},
4910-
expWorkerConnections: 1024,
4910+
expWorkerConnections: defaultWorkerConnections,
49114911
},
49124912
{
49134913
msg: "NginxProxy doesn't specify worker connections",
49144914
gw: &graph.Gateway{
49154915
EffectiveNginxProxy: &graph.EffectiveNginxProxy{},
49164916
},
4917-
expWorkerConnections: 1024,
4917+
expWorkerConnections: defaultWorkerConnections,
49184918
},
49194919
{
49204920
msg: "NginxProxy specifies worker connections",
@@ -4925,24 +4925,6 @@ func TestBuildWorkerConnections(t *testing.T) {
49254925
},
49264926
expWorkerConnections: 2048,
49274927
},
4928-
{
4929-
msg: "NginxProxy specifies minimum worker connections",
4930-
gw: &graph.Gateway{
4931-
EffectiveNginxProxy: &graph.EffectiveNginxProxy{
4932-
WorkerConnections: helpers.GetPointer(int32(1)),
4933-
},
4934-
},
4935-
expWorkerConnections: 1,
4936-
},
4937-
{
4938-
msg: "NginxProxy specifies maximum worker connections",
4939-
gw: &graph.Gateway{
4940-
EffectiveNginxProxy: &graph.EffectiveNginxProxy{
4941-
WorkerConnections: helpers.GetPointer(int32(65535)),
4942-
},
4943-
},
4944-
expWorkerConnections: 65535,
4945-
},
49464928
}
49474929

49484930
for _, tc := range tests {

0 commit comments

Comments
 (0)