@@ -102,7 +102,7 @@ export function snakeToCamel(name: string) {
102102import type mongodb from '../../../../mongodb.js' ;
103103export type { mongodb } ;
104104
105- const { MongoClient /* GridFSBucket */ } = require ( path . join ( MONGODB_DRIVER_PATH ) ) ;
105+ const { MongoClient, GridFSBucket } = require ( path . join ( MONGODB_DRIVER_PATH ) ) ;
106106
107107const DB_NAME = 'perftest' ;
108108const COLLECTION_NAME = 'corpus' ;
@@ -124,6 +124,7 @@ export function metrics(test_name: string, result: number, count: number) {
124124 } ,
125125 metrics : [
126126 { name : 'megabytes_per_second' , value : result } ,
127+ // Reporting the count so we can verify programmatically or in UI how many iterations we reached
127128 { name : 'count' , value : count }
128129 ]
129130 } as const ;
@@ -135,16 +136,28 @@ export function metrics(test_name: string, result: number, count: number) {
135136 */
136137export class DriverTester {
137138 private utilClient : mongodb . MongoClient ;
138- private client : mongodb . MongoClient ;
139+ public client : mongodb . MongoClient ;
139140 constructor ( ) {
140141 this . utilClient = new MongoClient ( MONGODB_URI , MONGODB_CLIENT_OPTIONS ) ;
141142 this . client = new MongoClient ( MONGODB_URI , MONGODB_CLIENT_OPTIONS ) ;
142143 }
143144
144- get ns ( ) {
145+ private get ns ( ) {
145146 return this . utilClient . db ( DB_NAME ) . collection ( COLLECTION_NAME ) ;
146147 }
147148
149+ public get db ( ) {
150+ return this . client . db ( DB_NAME ) ;
151+ }
152+
153+ public get collection ( ) {
154+ return this . client . db ( DB_NAME ) . collection ( COLLECTION_NAME ) ;
155+ }
156+
157+ public get bucket ( ) : mongodb . GridFSBucket {
158+ return new GridFSBucket ( this . db ) ;
159+ }
160+
148161 async drop ( ) {
149162 await this . ns . drop ( ) . catch ( ( ) => null ) ;
150163 await this . utilClient
@@ -154,7 +167,7 @@ export class DriverTester {
154167 }
155168
156169 async create ( ) {
157- return await this . utilClient . db ( DB_NAME ) . createCollection ( COLLECTION_NAME ) ;
170+ await this . utilClient . db ( DB_NAME ) . createCollection ( COLLECTION_NAME ) ;
158171 }
159172
160173 async load ( filePath : string , type : 'json' | 'string' | 'buffer' ) : Promise < any > {
0 commit comments