@@ -5,6 +5,7 @@ import { compressFrameSync } from 'lz4-napi';
55import { Request , Response } from 'node-fetch' ;
66import { ShouldRetryResult } from '../../../lib/connection/contracts/IRetryPolicy' ;
77import { HttpTransactionDetails } from '../../../lib/connection/contracts/IConnectionProvider' ;
8+ import { LogLevel } from '../../../lib/contracts/IDBSQLLogger' ;
89import CloudFetchResultHandler from '../../../lib/result/CloudFetchResultHandler' ;
910import ResultsProviderStub from '../.stubs/ResultsProviderStub' ;
1011import { TRowSet , TSparkArrowResultLink , TStatusCode } from '../../../thrift/TCLIService_types' ;
@@ -199,6 +200,26 @@ describe('CloudFetchResultHandler', () => {
199200 expect ( context . invokeWithRetryStub . called ) . to . be . false ;
200201 } ) ;
201202
203+ it ( 'should log cloud fetch download speed at debug level' , async ( ) => {
204+ const context = new ClientContextStub ( { cloudFetchConcurrentDownloads : 1 } ) ;
205+ const rowSetProvider = new ResultsProviderStub ( [ sampleRowSet1 ] , undefined ) ;
206+ const result = new CloudFetchResultHandler ( context , rowSetProvider , {
207+ status : { statusCode : TStatusCode . SUCCESS_STATUS } ,
208+ } ) ;
209+
210+ const logStub = sinon . stub ( context . logger , 'log' ) ;
211+ context . invokeWithRetryStub . callsFake ( async ( ) => ( {
212+ request : new Request ( 'localhost' ) ,
213+ response : new Response ( Buffer . concat ( [ sampleArrowSchema , sampleArrowBatch ] ) , { status : 200 } ) ,
214+ } ) ) ;
215+
216+ await result . fetchNext ( { limit : 10000 } ) ;
217+
218+ expect ( logStub . calledWith ( LogLevel . debug , sinon . match ( / R e s u l t F i l e D o w n l o a d s p e e d f r o m c l o u d s t o r a g e / ) ) ) . to . be . true ;
219+ expect ( logStub . neverCalledWith ( LogLevel . info , sinon . match ( / R e s u l t F i l e D o w n l o a d s p e e d f r o m c l o u d s t o r a g e / ) ) ) . to . be
220+ . true ;
221+ } ) ;
222+
202223 it ( 'should download batches according to settings' , async ( ) => {
203224 const context = new ClientContextStub ( { cloudFetchConcurrentDownloads : 3 } ) ;
204225 const clientConfig = context . getConfig ( ) ;
0 commit comments