Skip to content

Commit 6c0fc58

Browse files
JustinBeckwithBenjamin E. Coe
andauthored
test: run system and sample tests with cloud build (#383)
Co-authored-by: Benjamin E. Coe <bencoe@google.com>
1 parent bb6e1c2 commit 6c0fc58

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scheduler/test/test.samples.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,26 @@
1414

1515
'use strict';
1616

17+
const {CloudSchedulerClient} = require('@google-cloud/scheduler');
1718
const {assert} = require('chai');
18-
const {describe, it} = require('mocha');
19+
const {describe, it, before} = require('mocha');
1920
const cp = require('child_process');
2021
const supertest = require('supertest');
2122
const app = require('../app.js');
2223
const request = supertest(app);
2324

2425
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
25-
26-
const PROJECT_ID = process.env.GCLOUD_PROJECT;
2726
const LOCATION_ID = process.env.LOCATION_ID || 'us-central1';
2827
const SERVICE_ID = 'my-service';
2928

3029
describe('Cloud Scheduler Sample Tests', () => {
3130
let jobName;
31+
let PROJECT_ID;
32+
33+
before(async () => {
34+
const client = new CloudSchedulerClient();
35+
PROJECT_ID = await client.getProjectId();
36+
});
3237

3338
it('should create and delete a scheduler job', async () => {
3439
const stdout = execSync(

0 commit comments

Comments
 (0)