Skip to content

Commit 71d052d

Browse files
author
Evan Roman
committed
fix
1 parent 59c876b commit 71d052d

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

src/sql.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ describe('sql', () => {
3131
const id = uuid();
3232
const testData = getRandomTestData();
3333

34-
if (!poolConnection) {
35-
throw new Error('SQL connection pool is not initialized');
36-
}
37-
3834
// trigger by insert
3935
await poolConnection!.request().query(`INSERT INTO ${Sql.sqlTriggerTable} VALUES ('${id}', '${testData}');`);
4036
await waitForOutput(`sqlTrigger processed 1 changes`);

src/utils/cosmosdb/setupCosmosDB.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
import { CosmosClient, PartitionKeyKind } from '@azure/cosmos';
99
import { cosmosDBConnectionString } from '../connectionStrings';
1010
import { CosmosDB } from '../../constants';
11-
import { delay } from '../delay';
1211

1312
export async function setupCosmosDB() {
14-
try {
1513
const partitionKeyPath = `/${CosmosDB.partitionKey}`;
1614
if (!cosmosDBConnectionString) {
1715
throw new Error('CosmosDB connection string is not set');
@@ -26,9 +24,4 @@ export async function setupCosmosDB() {
2624
id: CosmosDB.triggerAndOutputContainerName,
2725
partitionKey: { paths: [partitionKeyPath], kind: PartitionKeyKind.Hash }
2826
});
29-
} catch (error) {
30-
console.error('Error setting up CosmosDB:', error);
31-
throw error;
32-
}
33-
await delay(30000);
3427
}

src/utils/sql/setupSql.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,14 @@ import { Sql } from '../../constants';
99
export async function runSqlSetupQueries() {
1010
// STEP 1: Create DB if not exists
1111
let pool = await createPoolConnnection(sqlConnectionString);
12-
try {
13-
await pool.request().query(`
14-
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = '${Sql.dbName}')
15-
BEGIN
16-
CREATE DATABASE [${Sql.dbName}];
17-
END
18-
`);
19-
} finally {
20-
await pool.close();
21-
}
12+
await pool.request().query(`
13+
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = '${Sql.dbName}')
14+
BEGIN
15+
CREATE DATABASE [${Sql.dbName}];
16+
END
17+
`);
2218

2319
// STEP 2: Retry ALTER DATABASE (change_tracking)
24-
pool = await createPoolConnnection(sqlConnectionString);
2520
try {
2621
await retry(async (currentAttempt) => {
2722
if (currentAttempt > 1) {
@@ -44,9 +39,6 @@ export async function runSqlSetupQueries() {
4439
retries: 5,
4540
minTimeout: 5000
4641
});
47-
} catch (err) {
48-
console.error("ALTER DATABASE failed:", err);
49-
throw err;
5042
} finally {
5143
await pool.close();
5244
}

0 commit comments

Comments
 (0)