Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor cloud sql server test #1692

Merged
merged 9 commits into from
Apr 1, 2020
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
9 changes: 5 additions & 4 deletions appengine/cloudsql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@
"node": ">=8.0.0"
},
"scripts": {
"unit-test": "mocha test/*.test.js --timeout=60000",
"unit-test": "mocha test/createTables.test.js --timeout=60000 && mocha test/server.test.js",
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &",
"system-test": "repo-tools test app -- server.js",
"system-test": "mocha test/serverListening.test.js --exit",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
"test": "npm -- run all-test"
},
"dependencies": {
"chai": "^4.2.0",
"express": "^4.16.4",
"knex": "^0.20.0",
"mysql": "^2.16.0",
"prompt": "^1.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"proxyquire": "^2.1.0",
"sinon": "^9.0.0",
"supertest": "^4.0.0"
"supertest": "^4.0.0",
"wait-port": "^0.2.7"
},
"cloud-repo-tools": {
"requiresKeyFile": true,
Expand Down
10 changes: 10 additions & 0 deletions appengine/cloudsql/test/serverListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const waitPort = require('wait-port');
const {expect} = require('chai');

describe('server listening', () => {
it('should be listening', async () => {
require('../server.js');
const isOpen = await waitPort({port: 8080});
expect(isOpen).to.be.true;
});
});