Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Updated default Postgres version for Data Connect to 17.
- Update Data Connect Emulator to 3.0.1, which addresses some internal errors (#9627)
2 changes: 1 addition & 1 deletion src/gcp/cloudsql/cloudsqladmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
name: string;
}

export async function iamUserIsCSQLAdmin(options: Options): Promise<boolean> {

Check warning on line 25 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const projectId = needProjectId(options);
const requiredPermissions = [
"cloudsql.instances.connect",
Expand All @@ -34,18 +34,18 @@
try {
const iamResult = await testIamPermissions(projectId, requiredPermissions);
return iamResult.passed;
} catch (err: any) {

Check warning on line 37 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
logger.debug(`[iam] error while checking permissions, command may fail: ${err}`);

Check warning on line 38 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
return false;
}
}

export async function listInstances(projectId: string): Promise<Instance[]> {

Check warning on line 43 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const res = await client.get<{ items: Instance[] }>(`projects/${projectId}/instances`);
return res.body.items ?? [];
}

export async function getInstance(projectId: string, instanceId: string): Promise<Instance> {

Check warning on line 48 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const res = await client.get<Instance>(`projects/${projectId}/instances/${instanceId}`);
if (res.body.state === "FAILED") {
throw new FirebaseError(
Expand All @@ -56,14 +56,14 @@
}

/** Returns a link to Cloud SQL's page in Cloud Console. */
export function instanceConsoleLink(projectId: string, instanceId: string) {

Check warning on line 59 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
return `https://console.cloud.google.com/sql/instances/${instanceId}/overview?project=${projectId}`;
}

export type DataConnectLabel = "ft" | "nt";
export const DEFAULT_DATABASE_VERSION = "POSTGRES_15";
export const DEFAULT_DATABASE_VERSION = "POSTGRES_17";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While changing the default version to POSTGRES_17 is the goal of this PR, the tests for createInstance in cloudsqladmin.spec.ts don't verify the request body. This means this change is not covered by automated tests. To improve maintainability and prevent potential regressions, I recommend enhancing the tests to assert that the databaseVersion in the API call payload matches this constant.


export async function createInstance(args: {

Check warning on line 66 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
projectId: string;
location: string;
instanceId: string;
Expand Down Expand Up @@ -97,7 +97,7 @@
},
});
return;
} catch (err: any) {

Check warning on line 100 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
handleAllowlistError(err, args.location);
throw err;
}
Expand Down Expand Up @@ -145,7 +145,7 @@
return pollRes;
}

function handleAllowlistError(err: any, region: string) {

Check warning on line 148 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 148 in src/gcp/cloudsql/cloudsqladmin.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
if (err.message.includes("Not allowed to set system label: firebase-data-connect")) {
throw new FirebaseError(
`Cloud SQL free trial instances are not yet available in ${region}. Please check https://firebase.google.com/docs/data-connect/ for a full list of available regions.`,
Expand Down
1 change: 0 additions & 1 deletion src/throttler/throttler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ const throttlerTest = (ThrottlerConstructor: ThrottlerConstructorType): void =>
expect(q.complete).to.equal(1);
expect(q.success).to.equal(0);
expect(q.errored).to.equal(1);
expect(q.retried).to.be.at.least(2);
expect(q.total).to.equal(1);
});

Expand Down
Loading