Skip to content

Commit cb9115e

Browse files
authored
Remove repo-tools from several samples (#1554)
1 parent 666e3ea commit cb9115e

File tree

8 files changed

+70
-61
lines changed

8 files changed

+70
-61
lines changed

cloud-tasks/function/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"@sendgrid/mail": "^6.4.0"
1414
},
1515
"devDependencies": {
16-
"@google-cloud/nodejs-repo-tools": "^3.3.0",
1716
"mocha": "^6.0.0",
1817
"proxyquire": "^2.1.0",
1918
"sinon": "^7.0.0"

datacatalog/cloud-client/package.json

-13
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,10 @@
1313
"test": "mocha system-test/*.test.js --timeout=60000"
1414
},
1515
"devDependencies": {
16-
"@google-cloud/nodejs-repo-tools": "^3.3.0",
1716
"mocha": "^6.0.0",
1817
"uuid": "^3.1.0"
1918
},
2019
"dependencies": {
2120
"@google-cloud/datacatalog": "^1.3.0"
22-
},
23-
"cloud-repo-tools": {
24-
"requiresKeyFile": true,
25-
"requiresProjectId": true,
26-
"test": {
27-
"build": {
28-
"requiredEnvVars": [
29-
"GCLOUD_PROJECT",
30-
"GCLOUD_DATASET_ID"
31-
]
32-
}
33-
}
3421
}
3522
}

datacatalog/cloud-client/system-test/createEntryGroup.test.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
const path = require('path');
1818
const assert = require('assert');
19-
const tools = require('@google-cloud/nodejs-repo-tools');
2019
const uuid = require('uuid');
2120
const cwd = path.join(__dirname, '..');
21+
const {exec} = require('child_process');
2222

2323
const projectId = process.env.GCLOUD_PROJECT;
2424
// Use unique id to avoid conflicts between concurrent test runs
@@ -28,16 +28,28 @@ const location = 'us-central1';
2828
const {DataCatalogClient} = require('@google-cloud/datacatalog').v1beta1;
2929
const datacatalog = new DataCatalogClient();
3030

31-
before(tools.checkCredentials);
31+
before(() => {
32+
assert(
33+
process.env.GCLOUD_PROJECT,
34+
`Must set GCLOUD_PROJECT environment variable!`
35+
);
36+
assert(
37+
process.env.GOOGLE_APPLICATION_CREDENTIALS,
38+
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
39+
);
40+
});
3241

3342
describe('createEntryGroup', () => {
34-
it('should create a entry group', async () => {
35-
const output = await tools.runAsync(
43+
it('should create a entry group', done => {
44+
const expectedName = `projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}`;
45+
exec(
3646
`node createEntryGroup.js ${projectId} ${entryGroupId}`,
37-
cwd
47+
{cwd},
48+
(err, stdout) => {
49+
assert.ok(stdout.includes(expectedName));
50+
done();
51+
}
3852
);
39-
const expectedName = `projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}`;
40-
assert.ok(output.includes(expectedName));
4153
});
4254

4355
after(async () => {

datacatalog/cloud-client/system-test/createFilesetEntry.test.js

+21-12
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
const path = require('path');
1818
const assert = require('assert');
19-
const tools = require('@google-cloud/nodejs-repo-tools');
2019
const uuid = require('uuid');
2120
const cwd = path.join(__dirname, '..');
21+
const {exec} = require('child_process');
2222

2323
const projectId = process.env.GCLOUD_PROJECT;
2424
// Use unique id to avoid conflicts between concurrent test runs
@@ -29,24 +29,33 @@ const location = 'us-central1';
2929
const {DataCatalogClient} = require('@google-cloud/datacatalog').v1beta1;
3030
const datacatalog = new DataCatalogClient();
3131

32-
before(tools.checkCredentials);
32+
before(() => {
33+
assert(
34+
process.env.GCLOUD_PROJECT,
35+
`Must set GCLOUD_PROJECT environment variable!`
36+
);
37+
assert(
38+
process.env.GOOGLE_APPLICATION_CREDENTIALS,
39+
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
40+
);
41+
});
3342

3443
describe('createFilesetEntry', () => {
35-
before(async () => {
44+
before(done => {
3645
// Must create entryGroup before creating entry
37-
await tools.runAsync(
38-
`node createEntryGroup.js ${projectId} ${entryGroupId}`,
39-
cwd
40-
);
46+
exec(`node createEntryGroup.js ${projectId} ${entryGroupId}`, {cwd}, done);
4147
});
4248

43-
it('should create a fileset entry', async () => {
44-
const output = await tools.runAsync(
49+
it('should create a fileset entry', done => {
50+
const expectedLinkedResource = `//datacatalog.googleapis.com/projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}/entries/${entryId}`;
51+
exec(
4552
`node createFilesetEntry.js ${projectId} ${entryGroupId} ${entryId}`,
46-
cwd
53+
{cwd},
54+
(err, stdout) => {
55+
assert.ok(stdout.includes(expectedLinkedResource));
56+
done();
57+
}
4758
);
48-
const expectedLinkedResource = `//datacatalog.googleapis.com/projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}/entries/${entryId}`;
49-
assert.ok(output.includes(expectedLinkedResource));
5059
});
5160

5261
after(async () => {

datacatalog/cloud-client/system-test/lookupEntry.test.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,32 @@
1616

1717
const path = require('path');
1818
const assert = require('assert');
19-
const tools = require('@google-cloud/nodejs-repo-tools');
2019
const cwd = path.join(__dirname, '..');
20+
const {exec} = require('child_process');
2121

22-
before(tools.checkCredentials);
22+
before(() => {
23+
assert(
24+
process.env.GCLOUD_PROJECT,
25+
`Must set GCLOUD_PROJECT environment variable!`
26+
);
27+
assert(
28+
process.env.GOOGLE_APPLICATION_CREDENTIALS,
29+
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
30+
);
31+
});
2332

2433
describe('lookupEntry lookup', () => {
25-
it('should lookup a dataset entry', async () => {
34+
it('should lookup a dataset entry', done => {
2635
const projectId = 'bigquery-public-data';
2736
const datasetId = 'new_york_taxi_trips';
28-
const output = await tools.runAsync(
37+
const expectedLinkedResource = `//bigquery.googleapis.com/projects/${projectId}/datasets/${datasetId}`;
38+
exec(
2939
`node lookupEntry.js ${projectId} ${datasetId}`,
30-
cwd
40+
{cwd},
41+
(err, stdout) => {
42+
assert.ok(stdout.includes(expectedLinkedResource));
43+
done();
44+
}
3145
);
32-
const expectedLinkedResource = `//bigquery.googleapis.com/projects/${projectId}/datasets/${datasetId}`;
33-
assert.ok(output.includes(expectedLinkedResource));
3446
});
3547
});

datastore/functions/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,5 @@
2727
"requestretry": "^4.0.0",
2828
"sinon": "^7.2.7",
2929
"uuid": "^3.3.2"
30-
},
31-
"cloud-repo-tools": {
32-
"requiresKeyFile": true,
33-
"requiresProjectId": true
3430
}
3531
}

storage-transfer/package.json

+2-16
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"unit-test": "mocha test/*.test.js --timeout=10000",
1616
"system-test": "mocha system-test/*.test.js --timeout=10000",
17-
"test": "repo-tools test install --cmd=npm -- run unit-test && repo-tools test install --cmd=npm -- run system-test"
17+
"test": "npm run unit-test && npm run system-test"
1818
},
1919
"dependencies": {
2020
"googleapis": "^45.0.0",
@@ -23,24 +23,10 @@
2323
},
2424
"devDependencies": {
2525
"@google-cloud/nodejs-repo-tools": "^3.3.0",
26+
"@google-cloud/storage": "^4.0.0",
2627
"mocha": "^6.0.0",
2728
"proxyquire": "^2.1.0",
2829
"sinon": "^7.2.7",
29-
"@google-cloud/storage": "^4.0.0",
3030
"uuid": "^3.3.2"
31-
},
32-
"cloud-repo-tools": {
33-
"requiresKeyFile": true,
34-
"requiresProjectId": true,
35-
"product": "storage",
36-
"samples": [
37-
{
38-
"id": "transfer",
39-
"name": "Storage Transfer API",
40-
"file": "transfer.js",
41-
"docs_link": "https://cloud.google.com/storage/transfer",
42-
"usage": "node transfer.js --help"
43-
}
44-
]
4531
}
4632
}

storage-transfer/system-test/transfer.test.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ const description = 'this is a test';
3333
const status = 'DISABLED';
3434

3535
before(async () => {
36-
tools.checkCredentials();
36+
assert(
37+
process.env.GCLOUD_PROJECT,
38+
`Must set GCLOUD_PROJECT environment variable!`
39+
);
40+
assert(
41+
process.env.GOOGLE_APPLICATION_CREDENTIALS,
42+
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
43+
);
44+
3745
tools.stubConsole();
3846

3947
const bucketOptions = {

0 commit comments

Comments
 (0)