Skip to content

Commit e7f2144

Browse files
samikshya-dbclaude
andcommitted
Fix unit tests for connection close telemetry
Update test files to match new telemetry interface changes: - Add latencyMs parameter to all emitConnectionOpen() test calls - Add missing DriverConfiguration fields in test mocks (osArch, runtimeVendor, localeName, charSetEncoding, authType, processName) This fixes TypeScript compilation errors introduced by the connection close telemetry implementation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 239e555 commit e7f2144

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

tests/unit/telemetry/DatabricksTelemetryExporter.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ describe('DatabricksTelemetryExporter', () => {
141141
nodeVersion: 'v16.0.0',
142142
platform: 'linux',
143143
osVersion: 'Ubuntu 20.04',
144+
osArch: 'x64',
145+
runtimeVendor: 'Node.js Foundation',
146+
localeName: 'en_US',
147+
charSetEncoding: 'UTF-8',
148+
processName: 'node',
149+
authType: 'pat',
144150
cloudFetchEnabled: true,
145151
lz4Enabled: true,
146152
arrowEnabled: false,

tests/unit/telemetry/MetricsAggregator.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ describe('MetricsAggregator', () => {
156156
nodeVersion: process.version,
157157
platform: process.platform,
158158
osVersion: 'test-os',
159+
osArch: 'x64',
160+
runtimeVendor: 'Node.js Foundation',
161+
localeName: 'en_US',
162+
charSetEncoding: 'UTF-8',
163+
processName: 'node',
164+
authType: 'pat',
159165
cloudFetchEnabled: true,
160166
lz4Enabled: true,
161167
arrowEnabled: false,

tests/unit/telemetry/TelemetryEventEmitter.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ describe('TelemetryEventEmitter', () => {
115115
nodeVersion: process.version,
116116
platform: process.platform,
117117
osVersion: 'test-os',
118+
osArch: 'x64',
119+
runtimeVendor: 'Node.js Foundation',
120+
localeName: 'en_US',
121+
charSetEncoding: 'UTF-8',
122+
processName: 'node',
123+
authType: 'pat',
118124
cloudFetchEnabled: true,
119125
lz4Enabled: true,
120126
arrowEnabled: false,
@@ -137,6 +143,7 @@ describe('TelemetryEventEmitter', () => {
137143
sessionId: 'session-123',
138144
workspaceId: 'workspace-456',
139145
driverConfig,
146+
latencyMs: 100,
140147
});
141148
});
142149

@@ -170,6 +177,7 @@ describe('TelemetryEventEmitter', () => {
170177
sessionId: 'session-123',
171178
workspaceId: 'workspace-456',
172179
driverConfig: {} as DriverConfiguration,
180+
latencyMs: 100,
173181
});
174182

175183
expect(eventEmitted).to.be.false;
@@ -186,6 +194,7 @@ describe('TelemetryEventEmitter', () => {
186194
sessionId: 'session-123',
187195
workspaceId: 'workspace-456',
188196
driverConfig: {} as DriverConfiguration,
197+
latencyMs: 100,
189198
});
190199

191200
expect((logger.log as sinon.SinonStub).calledWith(LogLevel.debug)).to.be.true;
@@ -201,6 +210,7 @@ describe('TelemetryEventEmitter', () => {
201210
sessionId: 'session-123',
202211
workspaceId: 'workspace-456',
203212
driverConfig: {} as DriverConfiguration,
213+
latencyMs: 100,
204214
});
205215

206216
const logStub = logger.log as sinon.SinonStub;
@@ -526,6 +536,7 @@ describe('TelemetryEventEmitter', () => {
526536
sessionId: 'session-123',
527537
workspaceId: 'workspace-456',
528538
driverConfig: {} as DriverConfiguration,
539+
latencyMs: 100,
529540
});
530541
}).to.not.throw();
531542
});
@@ -592,6 +603,7 @@ describe('TelemetryEventEmitter', () => {
592603
sessionId: 'session-123',
593604
workspaceId: 'workspace-456',
594605
driverConfig: {} as DriverConfiguration,
606+
latencyMs: 100,
595607
});
596608

597609
expect(consoleSpy.called).to.be.false;
@@ -663,6 +675,7 @@ describe('TelemetryEventEmitter', () => {
663675
sessionId: 'session-123',
664676
workspaceId: 'workspace-456',
665677
driverConfig: {} as DriverConfiguration,
678+
latencyMs: 100,
666679
});
667680

668681
expect(eventCount).to.equal(1);
@@ -699,6 +712,7 @@ describe('TelemetryEventEmitter', () => {
699712
sessionId: 'session-123',
700713
workspaceId: 'workspace-456',
701714
driverConfig: {} as DriverConfiguration,
715+
latencyMs: 100,
702716
});
703717
disabledEmitter.emitStatementStart({
704718
statementId: 'stmt-789',

0 commit comments

Comments
 (0)