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
2 changes: 2 additions & 0 deletions .github/config/nodejs-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
"batch",
"cloud-language",
"cloud-sql/mysql/mysql",
"cloud-sql/mysql/mysql2",
"cloud-sql/postgres/knex",
"cloud-tasks/snippets",
"cloud-tasks/tutorial-gcf/app",
"cloud-tasks/tutorial-gcf/function",
Expand Down
2 changes: 0 additions & 2 deletions .github/config/nodejs-prod.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
// TODO: fix these
"ai-platform/snippets", // PERMISSION_DENIED: Permission denied: Consumer 'projects/undefined' has been suspended.
"automl", // (untested) FAILED_PRECONDITION: Google Cloud AutoML Natural Language was retired on March 15, 2024. Please migrate to Vertex AI instead
"cloud-sql/mysql/mysql2", // (untested) Error: Cannot find module './connect-connector-with-iam-authn.js'
"cloud-sql/postgres/knex", // (untested) CloudSQLConnectorError: Malformed instance connection name provided: expected format of "PROJECT:REGION:INSTANCE", got undefined
"cloud-sql/sqlserver/mssql", // (untested) TypeError: The "config.server" property is required and must be of type string.
"cloud-sql/sqlserver/tedious", // (untested) TypeError: The "config.server" property is required and must be of type string.
"compute", // GoogleError: The resource 'projects/long-door-651/zones/us-central1-a/disks/disk-from-pool-name' was not found
Expand Down
14 changes: 14 additions & 0 deletions cloud-sql/mysql/mysql2/ci-setup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"INSTANCE_HOST": "127.0.0.1",
"INSTANCE_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:mysql-ci",
"UNIX_SOCKET_DIR": "tmp/cloudsql",
"CLOUD_SQL_CONNECTION_NAME": "$INSTANCE_CONNECTION_NAME",
"INSTANCE_UNIX_SOCKET": "$UNIX_SOCKET_DIR/$INSTANCE_CONNECTION_NAME",
"DB_NAME": "kokoro_ci",
"DB_USER": "kokoro_ci"
},
"secrets": {
"DB_PASS": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password"
}
}
8 changes: 3 additions & 5 deletions cloud-sql/mysql/mysql2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'use strict';

const express = require('express');
const createConnectorIAMAuthnPool = require('./connect-connector-with-iam-authn.js');
const createConnectorIAMAuthnPool = require('./connect-connector-auto-iam-authn.js');
const createConnectorPool = require('./connect-connector.js');
const createTcpPool = require('./connect-tcp.js');
const createUnixSocketPool = require('./connect-unix.js');
Expand Down Expand Up @@ -65,9 +65,7 @@ const createPool = async () => {
// 'connectTimeout' is the maximum number of milliseconds before a timeout
// occurs during the initial connection to the database.
connectTimeout: 10000, // 10 seconds
// 'acquireTimeout' is the maximum number of milliseconds to wait when
// checking out a connection from the pool before a timeout error occurs.
acquireTimeout: 10000, // 10 seconds
// 'acquireTimeout' is currently unsupported by mysql2
// 'waitForConnections' determines the pool's action when no connections are
// free. If true, the request will queued and a connection will be presented
// when ready. If false, the pool will call back with an error.
Expand Down Expand Up @@ -172,7 +170,7 @@ const httpGet = app.get('/', async (req, res) => {

// Run queries concurrently, and wait for them to complete
// This is faster than await-ing each query object as it is created
const recentVotes = await recentVotesQuery;
const [recentVotes] = await recentVotesQuery; // Return only the results, not the field metadata
const [tabsVotes] = await tabsQuery;
const [spacesVotes] = await spacesQuery;

Expand Down
4 changes: 1 addition & 3 deletions cloud-sql/mysql/mysql2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"scripts": {
"start": "node server/server.js",
"system-test": "c8 mocha -p -j 2 test/server.test.js --timeout=60000 --exit",
"system-test-tcp": "c8 mocha -p -j 2 test/server-unix.test.js --timeout=60000 --exit",
"system-test-unix": "c8 mocha -p -j 2 test/server-unix.test.js --timeout=60000 --exit",
"test": "npm run system-test && npm run system-test-tcp && npm run system-test-unix"
"test": "npm run system-test"
},
"dependencies": {
"@google-cloud/cloud-sql-connector": "^1.0.0",
Expand Down
14 changes: 14 additions & 0 deletions cloud-sql/postgres/knex/ci-setup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"INSTANCE_HOST": "127.0.0.1",
"INSTANCE_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:postgres-ci",
"UNIX_SOCKET_DIR": "tmp/cloudsql",
"CLOUD_SQL_CONNECTION_NAME": "$INSTANCE_CONNECTION_NAME",
"INSTANCE_UNIX_SOCKET": "$UNIX_SOCKET_DIR/$INSTANCE_CONNECTION_NAME",
"DB_NAME": "kokoro_ci",
"DB_USER": "kokoro_ci"
},
"secrets": {
"DB_PASS": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password"
}
}
3 changes: 2 additions & 1 deletion cloud-sql/postgres/knex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
},
"scripts": {
"start": "node server/server.js",
"proxy": "$GITHUB_WORKSPACE/.github/workflows/utils/sql-proxy.sh",
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME &",
"test": "c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit"
"test": "npm run proxy -- c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit"
},
"dependencies": {
"@google-cloud/cloud-sql-connector": "^1.0.0",
Expand Down
Loading