From 210180bb886bcffb3aca320e39b5e0c87200b1ea Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 12:46:42 +1100 Subject: [PATCH 01/14] chore(ci): migrate sql sample to new ci --- .github/config/nodejs-dev.jsonc | 5 +++++ .github/config/nodejs-prod.jsonc | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) 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..2861cdfac6 100644 --- a/.github/config/nodejs-prod.jsonc +++ b/.github/config/nodejs-prod.jsonc @@ -77,11 +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/mysql", // (untested) Error: expected 200 "OK", got 500 "Internal Server Error" - "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 "dataproc", // GoogleError: Error submitting create cluster request: Multiple validation errors "datastore/functions", // [ERR_REQUIRE_ESM]: require() of ES Module From f852e603845067f43e1b2775e27c9f2d331ba218 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 12:51:06 +1100 Subject: [PATCH 02/14] noop --- cloud-sql/mysql/mysql/index.js | 1 + cloud-sql/mysql/mysql2/index.js | 1 + cloud-sql/postgres/knex/index.js | 1 + cloud-sql/sqlserver/mssql/index.js | 1 + cloud-sql/sqlserver/tedious/index.js | 1 + 5 files changed, 5 insertions(+) diff --git a/cloud-sql/mysql/mysql/index.js b/cloud-sql/mysql/mysql/index.js index 018779dcca..3d0579cd38 100644 --- a/cloud-sql/mysql/mysql/index.js +++ b/cloud-sql/mysql/mysql/index.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; const express = require('express'); diff --git a/cloud-sql/mysql/mysql2/index.js b/cloud-sql/mysql/mysql2/index.js index 8fccda235f..f80c2bd075 100644 --- a/cloud-sql/mysql/mysql2/index.js +++ b/cloud-sql/mysql/mysql2/index.js @@ -14,6 +14,7 @@ 'use strict'; + const express = require('express'); const createConnectorIAMAuthnPool = require('./connect-connector-with-iam-authn.js'); const createConnectorPool = require('./connect-connector.js'); diff --git a/cloud-sql/postgres/knex/index.js b/cloud-sql/postgres/knex/index.js index aaf0cb1cf3..f3d29ac97d 100644 --- a/cloud-sql/postgres/knex/index.js +++ b/cloud-sql/postgres/knex/index.js @@ -11,6 +11,7 @@ // 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. + 'use strict'; const express = require('express'); diff --git a/cloud-sql/sqlserver/mssql/index.js b/cloud-sql/sqlserver/mssql/index.js index b9ab693f85..6963f8c469 100644 --- a/cloud-sql/sqlserver/mssql/index.js +++ b/cloud-sql/sqlserver/mssql/index.js @@ -14,6 +14,7 @@ 'use strict'; + const express = require('express'); const createTcpPool = require('./connect-tcp.js'); const mssql = require('mssql'); diff --git a/cloud-sql/sqlserver/tedious/index.js b/cloud-sql/sqlserver/tedious/index.js index d9c91fa6d2..b3c4868282 100644 --- a/cloud-sql/sqlserver/tedious/index.js +++ b/cloud-sql/sqlserver/tedious/index.js @@ -14,6 +14,7 @@ 'use strict'; + const express = require('express'); const createConnectorConnection = require('./connect-connector.js'); const createTcpConnection = require('./connect-tcp.js'); From e252446d234ffc9ade57f8d4a1271d984b3a2efb Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 12:56:22 +1100 Subject: [PATCH 03/14] Revert "noop" This reverts commit f852e603845067f43e1b2775e27c9f2d331ba218. --- cloud-sql/mysql/mysql/index.js | 1 - cloud-sql/mysql/mysql2/index.js | 1 - cloud-sql/postgres/knex/index.js | 1 - cloud-sql/sqlserver/mssql/index.js | 1 - cloud-sql/sqlserver/tedious/index.js | 1 - 5 files changed, 5 deletions(-) diff --git a/cloud-sql/mysql/mysql/index.js b/cloud-sql/mysql/mysql/index.js index 3d0579cd38..018779dcca 100644 --- a/cloud-sql/mysql/mysql/index.js +++ b/cloud-sql/mysql/mysql/index.js @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - 'use strict'; const express = require('express'); diff --git a/cloud-sql/mysql/mysql2/index.js b/cloud-sql/mysql/mysql2/index.js index f80c2bd075..8fccda235f 100644 --- a/cloud-sql/mysql/mysql2/index.js +++ b/cloud-sql/mysql/mysql2/index.js @@ -14,7 +14,6 @@ 'use strict'; - const express = require('express'); const createConnectorIAMAuthnPool = require('./connect-connector-with-iam-authn.js'); const createConnectorPool = require('./connect-connector.js'); diff --git a/cloud-sql/postgres/knex/index.js b/cloud-sql/postgres/knex/index.js index f3d29ac97d..aaf0cb1cf3 100644 --- a/cloud-sql/postgres/knex/index.js +++ b/cloud-sql/postgres/knex/index.js @@ -11,7 +11,6 @@ // 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. - 'use strict'; const express = require('express'); diff --git a/cloud-sql/sqlserver/mssql/index.js b/cloud-sql/sqlserver/mssql/index.js index 6963f8c469..b9ab693f85 100644 --- a/cloud-sql/sqlserver/mssql/index.js +++ b/cloud-sql/sqlserver/mssql/index.js @@ -14,7 +14,6 @@ 'use strict'; - const express = require('express'); const createTcpPool = require('./connect-tcp.js'); const mssql = require('mssql'); diff --git a/cloud-sql/sqlserver/tedious/index.js b/cloud-sql/sqlserver/tedious/index.js index b3c4868282..d9c91fa6d2 100644 --- a/cloud-sql/sqlserver/tedious/index.js +++ b/cloud-sql/sqlserver/tedious/index.js @@ -14,7 +14,6 @@ 'use strict'; - const express = require('express'); const createConnectorConnection = require('./connect-connector.js'); const createTcpConnection = require('./connect-tcp.js'); From 67e334b4abff04b6da9c782994c9d888de511da6 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:01:14 +1100 Subject: [PATCH 04/14] correct local file name --- cloud-sql/mysql/mysql2/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'); From d69aa75196d48fa5b7d83f94aa8142c7e212b496 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:01:22 +1100 Subject: [PATCH 05/14] basic config --- cloud-sql/mysql/mysql/ci-setup.json | 5 +++++ cloud-sql/mysql/mysql2/ci-setup.json | 5 +++++ cloud-sql/postgres/knex/ci-setup.json | 5 +++++ cloud-sql/sqlserver/mssql/ci-setup.json | 5 +++++ cloud-sql/sqlserver/tedious/ci-setup.json | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 cloud-sql/mysql/mysql/ci-setup.json create mode 100644 cloud-sql/mysql/mysql2/ci-setup.json create mode 100644 cloud-sql/postgres/knex/ci-setup.json create mode 100644 cloud-sql/sqlserver/mssql/ci-setup.json create mode 100644 cloud-sql/sqlserver/tedious/ci-setup.json diff --git a/cloud-sql/mysql/mysql/ci-setup.json b/cloud-sql/mysql/mysql/ci-setup.json new file mode 100644 index 0000000000..e6e444651e --- /dev/null +++ b/cloud-sql/mysql/mysql/ci-setup.json @@ -0,0 +1,5 @@ +{ + "env": { + "INSTANCE_HOST": "127.0.0.1" + } +} diff --git a/cloud-sql/mysql/mysql2/ci-setup.json b/cloud-sql/mysql/mysql2/ci-setup.json new file mode 100644 index 0000000000..e6e444651e --- /dev/null +++ b/cloud-sql/mysql/mysql2/ci-setup.json @@ -0,0 +1,5 @@ +{ + "env": { + "INSTANCE_HOST": "127.0.0.1" + } +} diff --git a/cloud-sql/postgres/knex/ci-setup.json b/cloud-sql/postgres/knex/ci-setup.json new file mode 100644 index 0000000000..e6e444651e --- /dev/null +++ b/cloud-sql/postgres/knex/ci-setup.json @@ -0,0 +1,5 @@ +{ + "env": { + "INSTANCE_HOST": "127.0.0.1" + } +} diff --git a/cloud-sql/sqlserver/mssql/ci-setup.json b/cloud-sql/sqlserver/mssql/ci-setup.json new file mode 100644 index 0000000000..e6e444651e --- /dev/null +++ b/cloud-sql/sqlserver/mssql/ci-setup.json @@ -0,0 +1,5 @@ +{ + "env": { + "INSTANCE_HOST": "127.0.0.1" + } +} diff --git a/cloud-sql/sqlserver/tedious/ci-setup.json b/cloud-sql/sqlserver/tedious/ci-setup.json new file mode 100644 index 0000000000..e6e444651e --- /dev/null +++ b/cloud-sql/sqlserver/tedious/ci-setup.json @@ -0,0 +1,5 @@ +{ + "env": { + "INSTANCE_HOST": "127.0.0.1" + } +} From f0349322a3ea51680d344c19561aa644b40d2375 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:26:33 +1100 Subject: [PATCH 06/14] add full settings --- cloud-sql/mysql/mysql/ci-setup.json | 10 +++++++--- cloud-sql/mysql/mysql2/ci-setup.json | 10 +++++++--- cloud-sql/postgres/knex/ci-setup.json | 10 +++++++--- cloud-sql/sqlserver/mssql/ci-setup.json | 10 +++++++--- cloud-sql/sqlserver/tedious/ci-setup.json | 10 +++++++--- 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/cloud-sql/mysql/mysql/ci-setup.json b/cloud-sql/mysql/mysql/ci-setup.json index e6e444651e..2ccf7cf6f0 100644 --- a/cloud-sql/mysql/mysql/ci-setup.json +++ b/cloud-sql/mysql/mysql/ci-setup.json @@ -1,5 +1,9 @@ { "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/mysql2/ci-setup.json b/cloud-sql/mysql/mysql2/ci-setup.json index e6e444651e..2ccf7cf6f0 100644 --- a/cloud-sql/mysql/mysql2/ci-setup.json +++ b/cloud-sql/mysql/mysql2/ci-setup.json @@ -1,5 +1,9 @@ { "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/postgres/knex/ci-setup.json b/cloud-sql/postgres/knex/ci-setup.json index e6e444651e..0e8962feec 100644 --- a/cloud-sql/postgres/knex/ci-setup.json +++ b/cloud-sql/postgres/knex/ci-setup.json @@ -1,5 +1,9 @@ { "env": { - "INSTANCE_HOST": "127.0.0.1" - } -} + "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/sqlserver/mssql/ci-setup.json b/cloud-sql/sqlserver/mssql/ci-setup.json index e6e444651e..3902a677f0 100644 --- a/cloud-sql/sqlserver/mssql/ci-setup.json +++ b/cloud-sql/sqlserver/mssql/ci-setup.json @@ -1,5 +1,9 @@ { "env": { - "INSTANCE_HOST": "127.0.0.1" - } -} + "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/ci-setup.json b/cloud-sql/sqlserver/tedious/ci-setup.json index e6e444651e..3902a677f0 100644 --- a/cloud-sql/sqlserver/tedious/ci-setup.json +++ b/cloud-sql/sqlserver/tedious/ci-setup.json @@ -1,5 +1,9 @@ { "env": { - "INSTANCE_HOST": "127.0.0.1" - } -} + "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" } + } From 1cb81f19a84004dd4d00ec7bd276493673459d38 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:30:56 +1100 Subject: [PATCH 07/14] add static proxy setup file --- cloud-sql/mysql/mysql/package.json | 2 +- cloud-sql/mysql/mysql/test/proxy-setup.sh | 19 +++++++++++++++++++ cloud-sql/postgres/knex/package.json | 2 +- cloud-sql/postgres/knex/test/proxy-setup.sh | 19 +++++++++++++++++++ cloud-sql/sqlserver/mssql/package.json | 2 +- cloud-sql/sqlserver/mssql/test/proxy-setup.sh | 19 +++++++++++++++++++ cloud-sql/sqlserver/tedious/package.json | 2 +- .../sqlserver/tedious/test/proxy-setup.sh | 19 +++++++++++++++++++ 8 files changed, 80 insertions(+), 4 deletions(-) create mode 100755 cloud-sql/mysql/mysql/test/proxy-setup.sh create mode 100755 cloud-sql/postgres/knex/test/proxy-setup.sh create mode 100755 cloud-sql/sqlserver/mssql/test/proxy-setup.sh create mode 100755 cloud-sql/sqlserver/tedious/test/proxy-setup.sh 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..c1006a8e9a --- /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 -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & 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/cloud-sql/postgres/knex/test/proxy-setup.sh b/cloud-sql/postgres/knex/test/proxy-setup.sh new file mode 100755 index 0000000000..c1006a8e9a --- /dev/null +++ b/cloud-sql/postgres/knex/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/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/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 & From 84580d6f68b9343cb9348a29e601da91c8bf168f Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:34:19 +1100 Subject: [PATCH 08/14] try: instance_host --- cloud-sql/mysql/mysql/ci-setup.json | 1 + 1 file changed, 1 insertion(+) diff --git a/cloud-sql/mysql/mysql/ci-setup.json b/cloud-sql/mysql/mysql/ci-setup.json index 2ccf7cf6f0..e55c9f5e32 100644 --- a/cloud-sql/mysql/mysql/ci-setup.json +++ b/cloud-sql/mysql/mysql/ci-setup.json @@ -1,5 +1,6 @@ { "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" From 2647cf4b0085eeb78478e8e48046c461d3730edf Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:37:33 +1100 Subject: [PATCH 09/14] temp disable during debugging --- .github/config/nodejs-prod.jsonc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/config/nodejs-prod.jsonc b/.github/config/nodejs-prod.jsonc index 2861cdfac6..2a3726260f 100644 --- a/.github/config/nodejs-prod.jsonc +++ b/.github/config/nodejs-prod.jsonc @@ -74,6 +74,12 @@ "memorystore/redis", // parent directory "recaptcha_enterprise/demosite/app", // no tests exist + // 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 From 740a4118ebcd324fef875840bcb67e1e95aac3fe Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:43:12 +1100 Subject: [PATCH 10/14] oh --- run/idp-sql/package.json | 2 +- run/idp-sql/test/proxy-setup.sh | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100755 run/idp-sql/test/proxy-setup.sh 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" }, diff --git a/run/idp-sql/test/proxy-setup.sh b/run/idp-sql/test/proxy-setup.sh deleted file mode 100755 index c1006a8e9a..0000000000 --- a/run/idp-sql/test/proxy-setup.sh +++ /dev/null @@ -1,19 +0,0 @@ -# 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 & From 2720f4204e7884ee24fdc5f4c79ad75774af1c3c Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 13:56:02 +1100 Subject: [PATCH 11/14] debug --- cloud-sql/mysql/mysql/test/proxy-setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cloud-sql/mysql/mysql/test/proxy-setup.sh b/cloud-sql/mysql/mysql/test/proxy-setup.sh index c1006a8e9a..2d58b76bec 100755 --- a/cloud-sql/mysql/mysql/test/proxy-setup.sh +++ b/cloud-sql/mysql/mysql/test/proxy-setup.sh @@ -14,6 +14,8 @@ # Proof of concept: setting up proxy +pwd 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 +ls cloud-sql-proxy -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & From 172b416831ccf916d0219c6a18743e8adba0684a Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 14:00:20 +1100 Subject: [PATCH 12/14] ... --- cloud-sql/mysql/mysql/test/proxy-setup.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cloud-sql/mysql/mysql/test/proxy-setup.sh b/cloud-sql/mysql/mysql/test/proxy-setup.sh index 2d58b76bec..46a2f95efa 100755 --- a/cloud-sql/mysql/mysql/test/proxy-setup.sh +++ b/cloud-sql/mysql/mysql/test/proxy-setup.sh @@ -14,8 +14,6 @@ # Proof of concept: setting up proxy -pwd 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 -ls -cloud-sql-proxy -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & +./cloud-sql-proxy -dir=/cloudsql -instances=$INSTANCE_CONNECTION_NAME & From 57a25279aa82a89561782b345e0f9eafdf439cc6 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 14:07:44 +1100 Subject: [PATCH 13/14] wrong flag --- cloud-sql/mysql/mysql/test/proxy-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-sql/mysql/mysql/test/proxy-setup.sh b/cloud-sql/mysql/mysql/test/proxy-setup.sh index 46a2f95efa..8999ba18dc 100755 --- a/cloud-sql/mysql/mysql/test/proxy-setup.sh +++ b/cloud-sql/mysql/mysql/test/proxy-setup.sh @@ -16,4 +16,4 @@ 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 & +./cloud-sql-proxy -instances=$INSTANCE_CONNECTION_NAME & From 5c98171c4b16028280048f577df3877173929524 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 25 Mar 2025 14:27:02 +1100 Subject: [PATCH 14/14] v2 format --- cloud-sql/mysql/mysql/test/proxy-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-sql/mysql/mysql/test/proxy-setup.sh b/cloud-sql/mysql/mysql/test/proxy-setup.sh index 8999ba18dc..1c92a8cfe5 100755 --- a/cloud-sql/mysql/mysql/test/proxy-setup.sh +++ b/cloud-sql/mysql/mysql/test/proxy-setup.sh @@ -16,4 +16,4 @@ 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 -instances=$INSTANCE_CONNECTION_NAME & +./cloud-sql-proxy $INSTANCE_CONNECTION_NAME &