diff --git a/.github/config/nodejs-dev.jsonc b/.github/config/nodejs-dev.jsonc index 4dbb31c0f5..e8d002c411 100644 --- a/.github/config/nodejs-dev.jsonc +++ b/.github/config/nodejs-dev.jsonc @@ -100,6 +100,11 @@ "auth", "batch", "cloud-language", + "cloud-sql/mysql/mysql", + "cloud-sql/mysql/mysql2", + "cloud-sql/postgres/knex", + "cloud-sql/sqlserver/mssql", + "cloud-sql/sqlserver/tedious", "cloud-tasks/snippets", "cloud-tasks/tutorial-gcf/app", "cloud-tasks/tutorial-gcf/function", diff --git a/.github/config/nodejs-prod.jsonc b/.github/config/nodejs-prod.jsonc index b2a2a4cdf1..2a3726260f 100644 --- a/.github/config/nodejs-prod.jsonc +++ b/.github/config/nodejs-prod.jsonc @@ -74,14 +74,15 @@ "memorystore/redis", // parent directory "recaptcha_enterprise/demosite/app", // no tests exist - // 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/mysql", // (untested) Error: expected 200 "OK", got 500 "Internal Server Error" + // TEMP DISABLE during debugging. "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. + + // 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 "compute", // GoogleError: The resource 'projects/long-door-651/zones/us-central1-a/disks/disk-from-pool-name' was not found "dataproc", // GoogleError: Error submitting create cluster request: Multiple validation errors "datastore/functions", // [ERR_REQUIRE_ESM]: require() of ES Module diff --git a/cloud-sql/mysql/mysql/ci-setup.json b/cloud-sql/mysql/mysql/ci-setup.json new file mode 100644 index 0000000000..e55c9f5e32 --- /dev/null +++ b/cloud-sql/mysql/mysql/ci-setup.json @@ -0,0 +1,10 @@ +{ + "env": { + "INSTANCE_HOST": "127.0.0.1", + "CLOUD_SQL_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:mysql-ci", + "DB_NAME": "kokoro_ci", + "DB_USER": "kokoro_ci" + }, + "secrets": { + "DB_PASSWORD": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password" } + } diff --git a/cloud-sql/mysql/mysql/package.json b/cloud-sql/mysql/mysql/package.json index a9ee12aa61..923ee2e15e 100644 --- a/cloud-sql/mysql/mysql/package.json +++ b/cloud-sql/mysql/mysql/package.json @@ -13,7 +13,7 @@ }, "scripts": { "start": "node server/server.js", - "system-test": "c8 mocha -p -j 2 test/server.test.js --timeout=60000 --exit", + "system-test": "test/proxy-setup.sh && c8 mocha -p -j 2 test/server.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-unix" }, diff --git a/cloud-sql/mysql/mysql/test/proxy-setup.sh b/cloud-sql/mysql/mysql/test/proxy-setup.sh new file mode 100755 index 0000000000..1c92a8cfe5 --- /dev/null +++ b/cloud-sql/mysql/mysql/test/proxy-setup.sh @@ -0,0 +1,19 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Proof of concept: setting up proxy + +curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.15.1/cloud-sql-proxy.linux.amd64 +chmod +x cloud-sql-proxy +./cloud-sql-proxy $INSTANCE_CONNECTION_NAME & diff --git a/cloud-sql/mysql/mysql2/ci-setup.json b/cloud-sql/mysql/mysql2/ci-setup.json new file mode 100644 index 0000000000..2ccf7cf6f0 --- /dev/null +++ b/cloud-sql/mysql/mysql2/ci-setup.json @@ -0,0 +1,9 @@ +{ + "env": { + "CLOUD_SQL_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:mysql-ci", + "DB_NAME": "kokoro_ci", + "DB_USER": "kokoro_ci" + }, + "secrets": { + "DB_PASSWORD": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password" } + } diff --git a/cloud-sql/mysql/mysql2/index.js b/cloud-sql/mysql/mysql2/index.js index 8fccda235f..6000dbdebf 100644 --- a/cloud-sql/mysql/mysql2/index.js +++ b/cloud-sql/mysql/mysql2/index.js @@ -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'); diff --git a/cloud-sql/postgres/knex/ci-setup.json b/cloud-sql/postgres/knex/ci-setup.json new file mode 100644 index 0000000000..0e8962feec --- /dev/null +++ b/cloud-sql/postgres/knex/ci-setup.json @@ -0,0 +1,9 @@ +{ + "env": { + "CLOUD_SQL_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:postgres-ci", + "DB_NAME": "kokoro_ci", + "DB_USER": "kokoro_ci" + }, + "secrets": { + "DB_PASSWORD": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password" } + } diff --git a/cloud-sql/postgres/knex/package.json b/cloud-sql/postgres/knex/package.json index 82e204f2f5..998060e76f 100644 --- a/cloud-sql/postgres/knex/package.json +++ b/cloud-sql/postgres/knex/package.json @@ -15,7 +15,7 @@ "scripts": { "start": "node server/server.js", "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": "test/proxy-setup.sh && c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit" }, "dependencies": { "@google-cloud/cloud-sql-connector": "^1.0.0", diff --git a/run/idp-sql/test/proxy-setup.sh b/cloud-sql/postgres/knex/test/proxy-setup.sh similarity index 100% rename from run/idp-sql/test/proxy-setup.sh rename to cloud-sql/postgres/knex/test/proxy-setup.sh diff --git a/cloud-sql/sqlserver/mssql/ci-setup.json b/cloud-sql/sqlserver/mssql/ci-setup.json new file mode 100644 index 0000000000..3902a677f0 --- /dev/null +++ b/cloud-sql/sqlserver/mssql/ci-setup.json @@ -0,0 +1,9 @@ +{ + "env": { + "CLOUD_SQL_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:mssql-ci", + "DB_NAME": "kokoro_ci", + "DB_USER": "kokoro_ci" + }, + "secrets": { + "DB_PASSWORD": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password" } + } diff --git a/cloud-sql/sqlserver/mssql/package.json b/cloud-sql/sqlserver/mssql/package.json index c048ae73a4..a88e465efa 100644 --- a/cloud-sql/sqlserver/mssql/package.json +++ b/cloud-sql/sqlserver/mssql/package.json @@ -13,7 +13,7 @@ }, "scripts": { "start": "node server/server.js", - "system-test": "c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit", + "system-test": "test/proxy-setup.sh && c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit", "test": "npm run system-test" }, "dependencies": { diff --git a/cloud-sql/sqlserver/mssql/test/proxy-setup.sh b/cloud-sql/sqlserver/mssql/test/proxy-setup.sh new file mode 100755 index 0000000000..c1006a8e9a --- /dev/null +++ b/cloud-sql/sqlserver/mssql/test/proxy-setup.sh @@ -0,0 +1,19 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Proof of concept: setting up proxy + +curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.15.1/cloud-sql-proxy.linux.amd64 +chmod +x cloud-sql-proxy +cloud-sql-proxy -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & diff --git a/cloud-sql/sqlserver/tedious/ci-setup.json b/cloud-sql/sqlserver/tedious/ci-setup.json new file mode 100644 index 0000000000..3902a677f0 --- /dev/null +++ b/cloud-sql/sqlserver/tedious/ci-setup.json @@ -0,0 +1,9 @@ +{ + "env": { + "CLOUD_SQL_CONNECTION_NAME": "nodejs-docs-samples-tests:us-central1:mssql-ci", + "DB_NAME": "kokoro_ci", + "DB_USER": "kokoro_ci" + }, + "secrets": { + "DB_PASSWORD": "nodejs-docs-samples-tests/nodejs-docs-samples-sql-password" } + } diff --git a/cloud-sql/sqlserver/tedious/package.json b/cloud-sql/sqlserver/tedious/package.json index 897a5bc7a5..2db7a05203 100644 --- a/cloud-sql/sqlserver/tedious/package.json +++ b/cloud-sql/sqlserver/tedious/package.json @@ -13,7 +13,7 @@ }, "scripts": { "start": "node server/server.js", - "system-test": "c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit", + "system-test": "test/proxy-setup.sh && c8 mocha -p -j 2 test/*.test.js --timeout=60000 --exit", "test": "npm run system-test" }, "dependencies": { diff --git a/cloud-sql/sqlserver/tedious/test/proxy-setup.sh b/cloud-sql/sqlserver/tedious/test/proxy-setup.sh new file mode 100755 index 0000000000..c1006a8e9a --- /dev/null +++ b/cloud-sql/sqlserver/tedious/test/proxy-setup.sh @@ -0,0 +1,19 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Proof of concept: setting up proxy + +curl -o cloud-sql-proxy https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v2.15.1/cloud-sql-proxy.linux.amd64 +chmod +x cloud-sql-proxy +cloud-sql-proxy -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & diff --git a/run/idp-sql/package.json b/run/idp-sql/package.json index 7bdfd66704..1febe62959 100644 --- a/run/idp-sql/package.json +++ b/run/idp-sql/package.json @@ -15,7 +15,7 @@ "scripts": { "start": "node index.js", "unit-test": "c8 mocha -p -j 2 test/app.test.js --timeout=120000 --exit", - "system-test": "test/proxy-setup.sh && c8 mocha -p -j 2 test/system.test.js --timeout=1800000 --exit", + "system-test": "c8 mocha -p -j 2 test/system.test.js --timeout=1800000 --exit", "all-test": "npm run unit-test && npm run system-test", "test": "npm -- run all-test" },