@@ -147,3 +147,55 @@ func TestGenerateMgmtFiles_Panic(t *testing.T) {
147
147
gen .generateMgmtFiles (dataplane.Configuration {})
148
148
}).To (Panic ())
149
149
}
150
+
151
+ func TestExecuteMainConfig_WorkerConnections (t * testing.T ) {
152
+ t .Parallel ()
153
+
154
+ tests := []struct {
155
+ name string
156
+ expWorkerConnections string
157
+ conf dataplane.Configuration
158
+ }{
159
+ {
160
+ name : "default worker connections" ,
161
+ conf : dataplane.Configuration {
162
+ WorkerConnections : 1024 ,
163
+ },
164
+ expWorkerConnections : "worker_connections 1024;" ,
165
+ },
166
+ {
167
+ name : "custom worker connections" ,
168
+ conf : dataplane.Configuration {
169
+ WorkerConnections : 2048 ,
170
+ },
171
+ expWorkerConnections : "worker_connections 2048;" ,
172
+ },
173
+ {
174
+ name : "minimum worker connections" ,
175
+ conf : dataplane.Configuration {
176
+ WorkerConnections : 1 ,
177
+ },
178
+ expWorkerConnections : "worker_connections 1;" ,
179
+ },
180
+ {
181
+ name : "maximum worker connections" ,
182
+ conf : dataplane.Configuration {
183
+ WorkerConnections : 65535 ,
184
+ },
185
+ expWorkerConnections : "worker_connections 65535;" ,
186
+ },
187
+ }
188
+
189
+ for _ , test := range tests {
190
+ t .Run (test .name , func (t * testing.T ) {
191
+ t .Parallel ()
192
+ g := NewWithT (t )
193
+
194
+ res := executeMainConfig (test .conf )
195
+ g .Expect (res ).To (HaveLen (1 ))
196
+ g .Expect (res [0 ].dest ).To (Equal (mainIncludesConfigFile ))
197
+ g .Expect (string (res [0 ].data )).To (ContainSubstring (test .expWorkerConnections ))
198
+ g .Expect (string (res [0 ].data )).To (ContainSubstring ("events {" ))
199
+ })
200
+ }
201
+ }
0 commit comments