File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ function telemetrySender(client){
6767 client . trackAvailability ( apiTelemetryData ) ;
6868 }
6969
70- if ( metricContext . certMetrics && Object . keys ( metricContext . certMetrics ) . length > 0 ) {
70+ if ( metricContext . certMetrics && Object . keys ( metricContext . certMetrics ) . length > 0 && metricContext . monitoringConfiguration . checkCertificate ) {
7171 let certTelemetryData = statics . enrichData ( metricContext . baseTelemetryData , metricContext . certMetrics , constants . keysForTelemetry ) ;
7272 console . log ( `tracking cert telemetry for ${ metricContext . testId } : ${ JSON . stringify ( certTelemetryData ) } ` )
7373 client . trackAvailability ( certTelemetryData ) ;
Original file line number Diff line number Diff line change @@ -238,6 +238,25 @@ describe('telemetrySender tests', () => {
238238 expect ( trackAvailability ) . toHaveBeenCalledTimes ( 1 ) ;
239239 } )
240240 } ) ;
241+
242+ test ( 'trackAvailability not called when cert metric provided but checkCertificate is false' , ( ) => {
243+
244+ dummyMetricContex . certMetrics = {
245+ 'duration' : 100 ,
246+ 'targetStatus' : 1 ,
247+ 'targetExpirationTimestamp' : 1000 ,
248+ 'httpStatus' : 200 ,
249+ 'targetTlsVersion' : 1.3 ,
250+ 'targetExpireInDays' : 8 ,
251+ 'domain' : "foo" ,
252+ 'checkCert' : true
253+ }
254+ dummyMetricContex . monitoringConfiguration . checkCertificate = false
255+
256+ return utils . telemetrySender ( dummyTelemetryClient ) ( dummyMetricContex ) . then ( data => {
257+ expect ( trackAvailability ) . toHaveBeenCalledTimes ( 0 ) ;
258+ } )
259+ } ) ;
241260
242261} )
243262
You can’t perform that action at this time.
0 commit comments