diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 29eac90347..d19318a28e 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -23,6 +23,10 @@ export TWILIO_NUMBER="+15005550006" # public placeholder value export TWILIO_ACCOUNT_SID=$(cat $KOKORO_GFILE_DIR/secrets-twilio-sid.txt) export TWILIO_AUTH_TOKEN=$(cat $KOKORO_GFILE_DIR/secrets-twilio-auth-token.txt) +# Configure Sendgrid variables +export SENDGRID_SENDER="test@google.com" +export SENDGRID_API_KEY=$(cat $KOKORO_GFILE_DIR/secrets-sendgrid-api-key.txt) + # Configure GCF variables export FUNCTIONS_TOPIC=integration-tests-instance export FUNCTIONS_BUCKET=$GCLOUD_PROJECT @@ -52,6 +56,10 @@ if [[ $PROJECT == functions/* ]]; then functions-emulator start fi +export NODEJS_IOT_EC_PUBLIC_KEY=${KOKORO_GFILE_DIR}/ec_public.pem +export NODEJS_IOT_RSA_PRIVATE_KEY=${KOKORO_GFILE_DIR}/rsa_private.pem +export NODEJS_IOT_RSA_PUBLIC_CERT=${KOKORO_GFILE_DIR}/rsa_cert.pem + npm test exit $? diff --git a/appengine/memcached/.cloud-repo-tools.json b/appengine/memcached/.cloud-repo-tools.json new file mode 100644 index 0000000000..3ce704afcb --- /dev/null +++ b/appengine/memcached/.cloud-repo-tools.json @@ -0,0 +1,14 @@ +{ + "test": { + "app": { + "msg": "Value:" + } + }, + "requiresKeyFile": true, + "requiresProjectId": true, + "requiredEnvVars": [ + "MEMCACHE_URL", + "MEMCACHE_USERNAME", + "MEMCACHE_PASSWORD" + ] +} \ No newline at end of file diff --git a/appengine/memcached/package.json b/appengine/memcached/package.json index 98f258a1cb..d6443f8e13 100644 --- a/appengine/memcached/package.json +++ b/appengine/memcached/package.json @@ -12,22 +12,11 @@ "start": "node app.js", "test": "repo-tools test app" }, - "cloud-repo-tools": { - "test": { - "app": { - "msg": "Value:" - } - }, - "requiresKeyFile": true, - "requiresProjectId": true, - "requiredEnvVars": [ - "MEMCACHE_URL", - "MEMCACHE_USERNAME", - "MEMCACHE_PASSWORD" - ] - }, "dependencies": { "express": "^4.16.4", "memjs": "^1.2.0" + }, + "devDependencies": { + "@google-cloud/nodejs-repo-tools": "^3.3.0" } } diff --git a/appengine/sendgrid/.cloud-repo-tools.json b/appengine/sendgrid/.cloud-repo-tools.json new file mode 100644 index 0000000000..da4dd17803 --- /dev/null +++ b/appengine/sendgrid/.cloud-repo-tools.json @@ -0,0 +1,13 @@ +{ + "test": { + "app": { + "msg": "Hello World!" + } + }, + "requiresKeyFile": true, + "requiresProjectId": true, + "requiredEnvVars": [ + "SENDGRID_SENDER", + "SENDGRID_API_KEY" + ] +} \ No newline at end of file diff --git a/appengine/sendgrid/package.json b/appengine/sendgrid/package.json index e14f6ebea4..7d87616bbf 100644 --- a/appengine/sendgrid/package.json +++ b/appengine/sendgrid/package.json @@ -10,20 +10,7 @@ }, "scripts": { "start": "node app.js", - "test": "mocha test/app.test.js" - }, - "cloud-repo-tools": { - "test": { - "app": { - "msg": "Value:" - } - }, - "requiresKeyFile": true, - "requiresProjectId": true, - "requiredEnvVars": [ - "SENDGRID_SENDER", - "SENDGRID_API_KEY" - ] + "test": "repo-tools test app && mocha test/*.test.js" }, "dependencies": { "body-parser": "^1.19.0", @@ -32,6 +19,7 @@ "@sendgrid/client": "^6.3.0" }, "devDependencies": { + "@google-cloud/nodejs-repo-tools": "^3.3.0", "assert": "^1.4.1", "mocha": "^6.1.4", "supertest": "^4.0.2" diff --git a/appengine/sendgrid/test/app.test.js b/appengine/sendgrid/test/app.test.js index 04be507901..a97af9f641 100644 --- a/appengine/sendgrid/test/app.test.js +++ b/appengine/sendgrid/test/app.test.js @@ -1,9 +1,12 @@ const assert = require('assert'); -const Supertest = require('supertest'); -const supertest = Supertest('http://localhost:8080'); +const path = require('path'); +const utils = require('@google-cloud/nodejs-repo-tools'); + +const cwd = path.join(__dirname, '../'); +const request = utils.getRequest({cwd: cwd}); it('GET /: should show homepage template', async () => { - await supertest + await request .get('/') .expect(200) .expect(response => { @@ -12,7 +15,7 @@ it('GET /: should show homepage template', async () => { }); it('POST /hello: should send an email', async () => { - await supertest + await request .post('/hello?test=true') .type('form') .send({email: 'testuser@google.com'})