Skip to content

Commit 53d2a29

Browse files
committed
test(NODE-6806): move benchmark tags into correct place
1 parent c0bac58 commit 53d2a29

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

packages/bson-bench/src/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ export type PerfSendMetricType =
175175
export type PerfSendResult = {
176176
info: {
177177
test_name: string;
178-
tags?: string[];
179178
args: Record<string, number>;
180179
};
181180
metrics: {
182181
name: string;
183182
value: number;
183+
metadata: { tags?: string[] };
184184
type?: PerfSendMetricType;
185185
version?: number;
186186
}[];

packages/bson-bench/src/task.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ export class Task {
108108
};
109109
const optionsWithNumericFields = convertOptions(this.benchmark.options);
110110

111+
const metadata = { tags: this.benchmark.tags };
111112
const perfSendResults: PerfSendResult = {
112113
info: {
113114
test_name: this.testName,
114-
tags: this.benchmark.tags,
115115
args: {
116116
warmup: this.benchmark.warmup,
117117
iterations: this.benchmark.iterations,
@@ -122,27 +122,32 @@ export class Task {
122122
{
123123
name: 'mean_megabytes_per_second',
124124
type: 'MEAN',
125-
value: meanThroughputMBps
125+
value: meanThroughputMBps,
126+
metadata
126127
},
127128
{
128129
name: 'median_megabytes_per_second',
129130
type: 'MEDIAN',
130-
value: medianThroughputMBps
131+
value: medianThroughputMBps,
132+
metadata
131133
},
132134
{
133135
name: 'min_megabytes_per_second',
134136
type: 'MIN',
135-
value: minThroughputMBps
137+
value: minThroughputMBps,
138+
metadata
136139
},
137140
{
138141
name: 'max_megabytes_per_second',
139142
type: 'MAX',
140-
value: maxThroughputMBps
143+
value: maxThroughputMBps,
144+
metadata
141145
},
142146
{
143147
name: 'stddev_megabytes_per_second',
144148
type: 'STANDARD_DEVIATION',
145-
value: throughputMBpsStddev
149+
value: throughputMBpsStddev,
150+
metadata
146151
}
147152
]
148153
};

packages/bson-bench/test/unit/task.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ describe('Task', function () {
151151
expect(results.info).to.haveOwnProperty('args');
152152
});
153153

154-
it('returns the tags in the info.tags field', function () {
155-
expect(results.info.tags).to.deep.equal(['test', 'test2']);
154+
it('returns the tags in the info.metrics.metadata field', function () {
155+
for (const m of results.metrics) {
156+
expect(m.metadata.tags).to.deep.equal(['test', 'test2']);
157+
}
156158
});
157159

158160
it('returns options provided in constructor in the info.args field', function () {

0 commit comments

Comments
 (0)