@@ -1014,3 +1014,47 @@ func TestSetIPFamily(t *testing.T) {
10141014 g .Expect (svc .Spec .IPFamilyPolicy ).To (Equal (helpers .GetPointer (corev1 .IPFamilyPolicySingleStack )))
10151015 g .Expect (svc .Spec .IPFamilies ).To (Equal ([]corev1.IPFamily {corev1 .IPv6Protocol }))
10161016}
1017+
1018+ func TestBuildNginxConfigMaps_WorkerConnections (t * testing.T ) {
1019+ t .Parallel ()
1020+ g := NewWithT (t )
1021+
1022+ provisioner := & NginxProvisioner {
1023+ cfg : Config {
1024+ GatewayPodConfig : & config.GatewayPodConfig {
1025+ Namespace : "default" ,
1026+ ServiceName : "test-service" ,
1027+ },
1028+ },
1029+ }
1030+ objectMeta := metav1.ObjectMeta {Name : "test" , Namespace : "default" }
1031+
1032+ // Test with default worker connections (nil NginxProxy config)
1033+ configMaps := provisioner .buildNginxConfigMaps (objectMeta , nil , "test-bootstrap" , "test-agent" , false , false )
1034+ g .Expect (configMaps ).To (HaveLen (2 ))
1035+
1036+ bootstrapCM , ok := configMaps [0 ].(* corev1.ConfigMap )
1037+ g .Expect (ok ).To (BeTrue ())
1038+ g .Expect (bootstrapCM .Data ["main.conf" ]).To (ContainSubstring ("worker_connections 1024;" ))
1039+
1040+ // Test with default worker connections (empty NginxProxy config)
1041+ nProxyCfgEmpty := & graph.EffectiveNginxProxy {}
1042+ configMaps = provisioner .buildNginxConfigMaps (objectMeta , nProxyCfgEmpty , "test-bootstrap" , "test-agent" , false , false )
1043+ g .Expect (configMaps ).To (HaveLen (2 ))
1044+
1045+ bootstrapCM , ok = configMaps [0 ].(* corev1.ConfigMap )
1046+ g .Expect (ok ).To (BeTrue ())
1047+ g .Expect (bootstrapCM .Data ["main.conf" ]).To (ContainSubstring ("worker_connections 1024;" ))
1048+
1049+ // Test with custom worker connections
1050+ nProxyCfg := & graph.EffectiveNginxProxy {
1051+ WorkerConnections : helpers .GetPointer (int32 (2048 )),
1052+ }
1053+
1054+ configMaps = provisioner .buildNginxConfigMaps (objectMeta , nProxyCfg , "test-bootstrap" , "test-agent" , false , false )
1055+ g .Expect (configMaps ).To (HaveLen (2 ))
1056+
1057+ bootstrapCM , ok = configMaps [0 ].(* corev1.ConfigMap )
1058+ g .Expect (ok ).To (BeTrue ())
1059+ g .Expect (bootstrapCM .Data ["main.conf" ]).To (ContainSubstring ("worker_connections 2048;" ))
1060+ }
0 commit comments