Skip to content

Commit 55a3e46

Browse files
committed
test: fix integration tests
1 parent 39d89a6 commit 55a3e46

17 files changed

+2474
-2439
lines changed

common/lib/wrapper_property.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ export interface AwsClientConfig {
106106
clusterInstanceHostPattern?: string;
107107
/** Set to true if you are providing a connection string with multiple comma-delimited hosts and your cluster has only one writer. The writer must be the first host in the connection string */
108108
singleWriterConnectionString?: boolean;
109-
/** Enables replacing a green host name with the original hostname after a blue/green switchover and the green name no longer resolves. */
110-
enableGreenHostReplacement?: boolean;
111109
/** The strategy that should be used to select a new reader host. */
112110
readerHostSelectorStrategy?: string;
113111
/** Maximum allowed time for the retries opening a connection. */
@@ -170,6 +168,8 @@ export interface AwsClientConfig {
170168
customEndpointMonitorExpirationMs?: number;
171169
/** The region of the cluster's custom endpoints. If not specified, the region will be parsed from the URL. */
172170
customEndpointRegion?: string;
171+
/** Enables replacing a green host name with the original hostname after a blue/green switchover and the green name no longer resolves. */
172+
enableGreenHostReplacement?: boolean;
173173
/** Connect timeout in milliseconds during Blue/Green Deployment switchover. */
174174
bgConnectTimeoutMs?: number;
175175
/** Blue/Green Deployment ID */

mysql/lib/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { MySQLClient, MySQLPoolClient } from "./mysql_client";
4444
import { DriverConnectionProvider } from "../../common/lib/driver_connection_provider";
4545
import { AwsClientConfig } from "../../common/lib/wrapper_property";
4646

47-
export interface AwsMysQLClientConfig extends ConnectionOptions, AwsClientConfig {}
47+
export interface AwsMySQLClientConfig extends ConnectionOptions, AwsClientConfig {}
4848

4949
class BaseAwsMySQLClient extends AwsClient implements MySQLClient {
5050
private static readonly knownDialectsByCode: Map<string, DatabaseDialect> = new Map([
@@ -54,7 +54,7 @@ class BaseAwsMySQLClient extends AwsClient implements MySQLClient {
5454
[DatabaseDialectCodes.RDS_MULTI_AZ_MYSQL, new RdsMultiAZClusterMySQLDatabaseDialect()]
5555
]);
5656

57-
constructor(config: AwsMysQLClientConfig, connectionProvider?: ConnectionProvider) {
57+
constructor(config: AwsMySQLClientConfig, connectionProvider?: ConnectionProvider) {
5858
super(
5959
config,
6060
DatabaseType.MYSQL,

tests/integration/container/tests/aurora_failover.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const itIf =
4040
: it.skip;
4141
const itIfTwoInstance = instanceCount == 2 ? itIf : it.skip;
4242
const itIfThreeInstanceAuroraCluster =
43-
instanceCount == 3 && !features.includes(TestEnvironmentFeatures.RDS_MULTI_AZ_CLUSTER_SUPPORTED) ? it : it.skip;
43+
instanceCount == 3 && !features.includes(TestEnvironmentFeatures.RDS_MULTI_AZ_SUPPORTED) ? it : it.skip;
4444

4545
let env: TestEnvironment;
4646
let driver;

tests/integration/container/tests/basic_connectivity.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@ import { AuroraTestUtility } from "./utils/aurora_test_utility";
2121
import { logger } from "../../../../common/logutils";
2222
import { DatabaseEngine } from "./utils/database_engine";
2323
import { TestEnvironmentFeatures } from "./utils/test_environment_features";
24-
import { features } from "./config";
24+
import { features, instanceCount } from "./config";
2525
import { DatabaseEngineDeployment } from "./utils/database_engine_deployment";
2626
import { PluginManager } from "../../../../index";
2727

2828
const itIf =
2929
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it : it.skip;
30+
const itIfMinTwoInstance = instanceCount >= 2 ? itIf : it.skip;
3031

3132
let client: any;
3233
let auroraTestUtility: AuroraTestUtility;
3334

34-
async function executeInstanceQuery(client: any, engine: DatabaseEngine, deployment: DatabaseEngineDeployment, props: any): Promise<void> {
35+
async function executeSelect1(client: any, engine: DatabaseEngine, deployment: DatabaseEngineDeployment, props: any): Promise<void> {
3536
await client.connect();
3637

37-
const res = await DriverHelper.executeInstanceQuery(engine, deployment, client);
38+
const res = await DriverHelper.executeQuery(engine, client, "SELECT 1", 10000);
3839

3940
expect(res).not.toBeNull();
4041
}
@@ -59,8 +60,8 @@ afterEach(async () => {
5960
logger.info(`Test finished: ${expect.getState().currentTestName}`);
6061
}, 1320000);
6162

62-
describe("basic_connectivity", () => {
63-
itIf(
63+
describe("basic connectivity", () => {
64+
itIfMinTwoInstance(
6465
"wrapper with failover plugins read only endpoint",
6566
async () => {
6667
const env = await TestEnvironment.getCurrent();
@@ -82,12 +83,12 @@ describe("basic_connectivity", () => {
8283
props = DriverHelper.addDriverSpecificConfiguration(props, env.engine);
8384
client = initClientFunc(props);
8485

85-
await executeInstanceQuery(client, env.engine, env.deployment, props);
86+
await executeSelect1(client, env.engine, env.deployment, props);
8687
},
8788
1320000
8889
);
8990

90-
itIf(
91+
itIfMinTwoInstance(
9192
"wrapper with failover plugins cluster endpoint",
9293
async () => {
9394
const env = await TestEnvironment.getCurrent();
@@ -109,7 +110,7 @@ describe("basic_connectivity", () => {
109110
props = DriverHelper.addDriverSpecificConfiguration(props, env.engine);
110111

111112
client = initClientFunc(props);
112-
await executeInstanceQuery(client, env.engine, env.deployment, props);
113+
await executeSelect1(client, env.engine, env.deployment, props);
113114
},
114115
1320000
115116
);
@@ -136,7 +137,7 @@ describe("basic_connectivity", () => {
136137
props = DriverHelper.addDriverSpecificConfiguration(props, env.engine);
137138

138139
client = initClientFunc(props);
139-
await executeInstanceQuery(client, env.engine, env.deployment, props);
140+
await executeSelect1(client, env.engine, env.deployment, props);
140141
},
141142
1320000
142143
);
@@ -165,15 +166,15 @@ describe("basic_connectivity", () => {
165166
client = initClientFunc(props);
166167
await client.connect();
167168

168-
const res = await DriverHelper.executeInstanceQuery(env.engine, env.deployment, client);
169+
const res = await executeSelect1(client, env.engine, env.deployment, props);
169170

170171
expect(res).not.toBeNull();
171172
},
172173
1320000
173174
);
174175

175176
itIf(
176-
"wrapper_proxy",
177+
"wrapper proxy",
177178
async () => {
178179
const env = await TestEnvironment.getCurrent();
179180
const driver = DriverHelper.getDriverForDatabaseEngine(env.engine);

tests/integration/container/tests/custom_endpoint.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const itIf =
4545
: it.skip;
4646

4747
// Custom endpoint is not compatible with multi-az clusters.
48-
const describeIf = !features.includes(TestEnvironmentFeatures.RDS_MULTI_AZ_CLUSTER_SUPPORTED) ? describe : describe.skip;
48+
const describeIf = !features.includes(TestEnvironmentFeatures.RDS_MULTI_AZ_SUPPORTED) ? describe : describe.skip;
4949

5050
const endpointId1 = `test-endpoint-1-${randomUUID()}`;
5151
const endpointId2 = `test-endpoint-2-${randomUUID()}`;

tests/integration/container/tests/parameterized_queries.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { features } from "./config";
2222
import { AwsPoolConfig, InternalPooledConnectionProvider, PluginManager } from "../../../../index";
2323
import { AwsPgPoolClient } from "../../../../pg";
2424
import { AwsMySQLPoolClient } from "../../../../mysql";
25+
import { readFileSync } from "fs";
2526

2627
const itIf =
2728
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it : it.skip;
@@ -39,6 +40,10 @@ async function createConnection(plugins: string = "failover"): Promise<any> {
3940
database: env.databaseInfo.defaultDbName,
4041
password: env.databaseInfo.password,
4142
port: env.databaseInfo.instanceEndpointPort,
43+
ssl: {
44+
rejectUnauthorized: false,
45+
ca: readFileSync("/app/global-bundle.pem").toString()
46+
},
4247
plugins
4348
};
4449
const configuredProps = DriverHelper.addDriverSpecificConfiguration(props, env.engine);
@@ -56,6 +61,10 @@ async function createAwsPGPool(plugins: string = "failover"): Promise<AwsPgPoolC
5661
database: env.databaseInfo.defaultDbName,
5762
password: env.databaseInfo.password,
5863
port: env.databaseInfo.instanceEndpointPort,
64+
ssl: {
65+
rejectUnauthorized: false,
66+
ca: readFileSync("/app/global-bundle.pem").toString()
67+
},
5968
plugins
6069
};
6170
const poolConfig = new AwsPoolConfig({
@@ -80,6 +89,10 @@ async function createAwsPGPoolWithICP(plugins: string = "failover"): Promise<Aws
8089
database: env.databaseInfo.defaultDbName,
8190
password: env.databaseInfo.password,
8291
port: env.databaseInfo.instanceEndpointPort,
92+
ssl: {
93+
rejectUnauthorized: false,
94+
ca: readFileSync("/app/global-bundle.pem").toString()
95+
},
8396
plugins,
8497
provider: provider
8598
};

tests/integration/container/tests/pg_pool.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
import { DriverHelper } from "./utils/driver_helper";
2929
import { AuroraTestUtility } from "./utils/aurora_test_utility";
3030
import { sleep } from "../../../../common/lib/utils/utils";
31+
import { readFileSync } from "fs";
3132

3233
const itIf =
3334
!features.includes(TestEnvironmentFeatures.PERFORMANCE) && !features.includes(TestEnvironmentFeatures.RUN_AUTOSCALING_TESTS_ONLY) ? it : it.skip;
@@ -48,6 +49,10 @@ async function createPool(plugins: string = "efm2,failover2"): Promise<any> {
4849
database: env.databaseInfo.defaultDbName,
4950
password: env.databaseInfo.password,
5051
port: env.databaseInfo.instanceEndpointPort,
52+
ssl: {
53+
rejectUnauthorized: false,
54+
ca: readFileSync("/app/global-bundle.pem").toString()
55+
},
5156
plugins
5257
};
5358
const poolConfig = new AwsPoolConfig({

0 commit comments

Comments
 (0)