diff --git a/cloud-sql/postgres/knex/.cloud-repo-tools.json b/cloud-sql/postgres/knex/.cloud-repo-tools.json deleted file mode 100644 index e289843e17..0000000000 --- a/cloud-sql/postgres/knex/.cloud-repo-tools.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "requiresKeyFile": true, - "requiresProjectId": true, - "test": { - "app": { - "requiredEnvVars": [ - "DB_USER", - "DB_PASS", - "DB_NAME", - "CLOUD_SQL_INSTANCE_NAME" - ], - "args": [ - "server.js" - ] - }, - "build": { - "requiredEnvVars": [ - "DB_USER", - "DB_PASS", - "DB_NAME", - "CLOUD_SQL_INSTANCE_NAME" - ] - } - } -} \ No newline at end of file diff --git a/cloud-sql/postgres/knex/app.standard.yaml b/cloud-sql/postgres/knex/app.standard.yaml index b94459f6e3..608834b32c 100644 --- a/cloud-sql/postgres/knex/app.standard.yaml +++ b/cloud-sql/postgres/knex/app.standard.yaml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -runtime: nodejs8 +runtime: nodejs10 # The following env variables may contain sensitive information that grants # anyone access to your database. Do not add this file to your source control. diff --git a/cloud-sql/postgres/knex/package.json b/cloud-sql/postgres/knex/package.json index b71019c76a..91f22dc6e3 100644 --- a/cloud-sql/postgres/knex/package.json +++ b/cloud-sql/postgres/knex/package.json @@ -10,15 +10,11 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" }, "scripts": { - "unit-test": "mocha test/*.test.js --timeout=60000 --exit", "start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -dir=/cloudsql -instances=$CLOUD_SQL_INSTANCE_NAME &", - "system-test": "repo-tools test app -- server.js", - "system-test-proxy": "npm run start-proxy; npm run system-test", - "all-test": "npm run unit-test && npm run system-test", - "test": "repo-tools test run --cmd npm -- run all-test" + "test": "mocha test/*.test.js --timeout=60000 --exit" }, "dependencies": { "@google-cloud/logging-winston": "^3.0.0", @@ -31,7 +27,6 @@ "yargs": "^15.0.0" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "3.3.0", "mocha": "^6.0.0", "supertest": "^4.0.0" } diff --git a/cloud-sql/postgres/knex/test/createTable.test.js b/cloud-sql/postgres/knex/test/createTable.test.js index b0d02356de..aa2e71ed84 100644 --- a/cloud-sql/postgres/knex/test/createTable.test.js +++ b/cloud-sql/postgres/knex/test/createTable.test.js @@ -17,7 +17,7 @@ const assert = require('assert'); const path = require('path'); const Knex = require('knex'); -const tools = require('@google-cloud/nodejs-repo-tools'); +const {exec} = require('child_process'); const cwd = path.join(__dirname, '..'); @@ -41,20 +41,25 @@ before(async () => { } }); -it('should create a table', async () => { - const output = await tools.runAsync( +it('should create a table', done => { + exec( `node createTable.js ${DB_USER} ${DB_PASS} ${DB_NAME} ${CONNECTION_NAME}`, - cwd + {cwd}, + (err, stdout) => { + assert.ok(stdout.includes(`Successfully created 'votes' table.`)); + done(); + } ); - assert.ok(output.includes(`Successfully created 'votes' table.`)); }); -it('should handle existing tables', async () => { - const {stderr} = await tools.runAsyncWithIO( +it('should handle existing tables', done => { + exec( `node createTable.js ${DB_USER} ${DB_PASS} ${DB_NAME} ${CONNECTION_NAME}`, - cwd + {cwd}, + (err, stdout, stderr) => { + assert.ok(stderr.includes("Failed to create 'votes' table:")); + assert.ok(stderr.includes('already exists')); + done(); + } ); - - assert.ok(stderr.includes("Failed to create 'votes' table:")); - assert.ok(stderr.includes('already exists')); });