File tree Expand file tree Collapse file tree 3 files changed +26
-13
lines changed
Expand file tree Collapse file tree 3 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -1419,6 +1419,19 @@ func Test_augmentWorkerOptions(t *testing.T) {
14191419 },
14201420 },
14211421 },
1422+ {
1423+ name : "autoscaler options: some fields set" ,
1424+ args : args {options : WorkerOptions {
1425+ AutoScalerOptions : AutoScalerOptions {
1426+ Enabled : true ,
1427+ },
1428+ }},
1429+ want : WorkerOptions {
1430+ AutoScalerOptions : AutoScalerOptions {
1431+ Enabled : true ,
1432+ },
1433+ },
1434+ },
14221435 }
14231436 for _ , tt := range tests {
14241437 t .Run (tt .name , func (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -216,11 +216,13 @@ func (c *ConcurrencyAutoScaler) logEvent(event autoScalerEvent) {
216216 }
217217 c .scope .Histogram (metricsPollerQuota , metricsPollerQuotaBuckets ).RecordValue (float64 (c .concurrency .PollerPermit .Quota ()))
218218 c .scope .Histogram (metricsPollerWaitTime , metricsPollerWaitTimeBuckets ).RecordDuration (c .pollerWaitTime .Average ())
219- c .log .Debug (autoScalerEventLogMsg ,
220- zap .String ("event" , string (event )),
221- zap .Bool ("enabled" , c .enabled ),
222- zap .Int ("poller_quota" , c .concurrency .PollerPermit .Quota ()),
223- )
219+ if event != autoScalerEventEmitMetrics {
220+ c .log .Debug (autoScalerEventLogMsg ,
221+ zap .String ("event" , string (event )),
222+ zap .Bool ("enabled" , c .enabled ),
223+ zap .Int ("poller_quota" , c .concurrency .PollerPermit .Quota ()),
224+ )
225+ }
224226}
225227
226228func (c * ConcurrencyAutoScaler ) updatePollerPermit () {
Original file line number Diff line number Diff line change @@ -301,15 +301,13 @@ func TestConcurrencyAutoScaler(t *testing.T) {
301301
302302 var actualEvents []eventLog
303303 for _ , event := range obs .FilterMessage (autoScalerEventLogMsg ).All () {
304- if event .ContextMap ()["event" ] != string (autoScalerEventEmitMetrics ) {
305- t .Log ("event: " , event .ContextMap ())
304+ t .Log ("event: " , event .ContextMap ())
306305
307- actualEvents = append (actualEvents , eventLog {
308- eventType : autoScalerEvent (event .ContextMap ()["event" ].(string )),
309- enabled : event .ContextMap ()["enabled" ].(bool ),
310- pollerQuota : event .ContextMap ()["poller_quota" ].(int64 ),
311- })
312- }
306+ actualEvents = append (actualEvents , eventLog {
307+ eventType : autoScalerEvent (event .ContextMap ()["event" ].(string )),
308+ enabled : event .ContextMap ()["enabled" ].(bool ),
309+ pollerQuota : event .ContextMap ()["poller_quota" ].(int64 ),
310+ })
313311 }
314312 assert .ElementsMatch (t , tt .expectedEvents , actualEvents )
315313 })
You can’t perform that action at this time.
0 commit comments