Skip to content

Commit

Permalink
fix: integration tests with connectionProvider (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-bq authored Nov 29, 2024
1 parent 06b0312 commit 71ed378
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions common/lib/connection_provider_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ export class ConnectionProviderManager {

return host;
}

getDefaultConnectionProvider(): ConnectionProvider {
return this.defaultProvider;
}
}
2 changes: 1 addition & 1 deletion common/lib/plugins/default_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class DefaultPlugin extends AbstractConnectionPlugin {
isInitialConnection: boolean,
forceConnectFunc: () => Promise<ClientWrapper>
): Promise<ClientWrapper> {
return await this.connectInternal(hostInfo, props, this.connectionProviderManager.getConnectionProvider(hostInfo, props));
return await this.connectInternal(hostInfo, props, this.connectionProviderManager.getDefaultConnectionProvider());
}

override initHostProvider(
Expand Down
3 changes: 3 additions & 0 deletions common/lib/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export function maskProperties(props: Map<string, any>) {
if (maskedProperties.has(WrapperProperties.PASSWORD.name)) {
maskedProperties.set(WrapperProperties.PASSWORD.name, "***");
}
// Remove connectionProvider property before displaying. AwsMysqlPoolClient.targetPool throws
// "TypeError: Converting circular structure to JSON" when sent to JSON.stringify.
maskedProperties.delete(WrapperProperties.CONNECTION_PROVIDER.name);
return maskedProperties;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ describe("aurora read write splitting", () => {
for (let i = 0; i < numOverloadedReaderConnections; i++) {
const readerConfig = await initDefaultConfig(env.databaseInfo.readerInstanceEndpoint, env.databaseInfo.instanceEndpointPort, false);
readerConfig["arbitraryProp"] = "value" + i.toString();
readerConfig["connectionProvider"] = provider;
readerConfig["readerHostSelectorStrategy"] = "leastConnections";
const client = initClientFunc(readerConfig);
await client.connect();
Expand Down

0 comments on commit 71ed378

Please sign in to comment.