Skip to content

Commit

Permalink
Remove repo-tools from several samples
Browse files Browse the repository at this point in the history
  • Loading branch information
fhinkel committed Nov 27, 2019
1 parent 666e3ea commit 79347de
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 40 deletions.
1 change: 0 additions & 1 deletion cloud-tasks/function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@sendgrid/mail": "^6.4.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^6.0.0",
"proxyquire": "^2.1.0",
"sinon": "^7.0.0"
Expand Down
13 changes: 0 additions & 13 deletions datacatalog/cloud-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,10 @@
"test": "mocha system-test/*.test.js --timeout=60000"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^6.0.0",
"uuid": "^3.1.0"
},
"dependencies": {
"@google-cloud/datacatalog": "^1.3.0"
},
"cloud-repo-tools": {
"requiresKeyFile": true,
"requiresProjectId": true,
"test": {
"build": {
"requiredEnvVars": [
"GCLOUD_PROJECT",
"GCLOUD_DATASET_ID"
]
}
}
}
}
26 changes: 19 additions & 7 deletions datacatalog/cloud-client/system-test/createEntryGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

const path = require('path');
const assert = require('assert');
const tools = require('@google-cloud/nodejs-repo-tools');
const uuid = require('uuid');
const cwd = path.join(__dirname, '..');
const {exec} = require('child_process');

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

before(tools.checkCredentials);
before(() => {
assert(
process.env.GCLOUD_PROJECT,
`Must set GCLOUD_PROJECT environment variable!`
);
assert(
process.env.GOOGLE_APPLICATION_CREDENTIALS,
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
);
});

describe('createEntryGroup', () => {
describe('createEntryGroup', done => {
it('should create a entry group', async () => {
const output = await tools.runAsync(
const expectedName = `projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}`;
exec(
`node createEntryGroup.js ${projectId} ${entryGroupId}`,
cwd
{cwd},
(err, stdout) => {
assert.ok(stdout.includes(expectedName));
done();
}
);
const expectedName = `projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}`;
assert.ok(output.includes(expectedName));
});

after(async () => {
Expand Down
33 changes: 21 additions & 12 deletions datacatalog/cloud-client/system-test/createFilesetEntry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

const path = require('path');
const assert = require('assert');
const tools = require('@google-cloud/nodejs-repo-tools');
const uuid = require('uuid');
const cwd = path.join(__dirname, '..');
const {exec} = require('child_process');

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

before(tools.checkCredentials);
before(() => {
assert(
process.env.GCLOUD_PROJECT,
`Must set GCLOUD_PROJECT environment variable!`
);
assert(
process.env.GOOGLE_APPLICATION_CREDENTIALS,
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
);
});

describe('createFilesetEntry', () => {
before(async () => {
before(done => {
// Must create entryGroup before creating entry
await tools.runAsync(
`node createEntryGroup.js ${projectId} ${entryGroupId}`,
cwd
);
exec(`node createEntryGroup.js ${projectId} ${entryGroupId}`, {cwd});
});

it('should create a fileset entry', async () => {
const output = await tools.runAsync(
it('should create a fileset entry', done => {
const expectedLinkedResource = `//datacatalog.googleapis.com/projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}/entries/${entryId}`;
exec(
`node createFilesetEntry.js ${projectId} ${entryGroupId} ${entryId}`,
cwd
{cwd},
(err, stdout) => {
assert.ok(stdout.includes(expectedLinkedResource));
done();
}
);
const expectedLinkedResource = `//datacatalog.googleapis.com/projects/${projectId}/locations/${location}/entryGroups/${entryGroupId}/entries/${entryId}`;
assert.ok(output.includes(expectedLinkedResource));
});

after(async () => {
Expand Down
25 changes: 18 additions & 7 deletions datacatalog/cloud-client/system-test/lookupEntry.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,31 @@

const path = require('path');
const assert = require('assert');
const tools = require('@google-cloud/nodejs-repo-tools');
const cwd = path.join(__dirname, '..');

before(tools.checkCredentials);
before(() => {
assert(
process.env.GCLOUD_PROJECT,
`Must set GCLOUD_PROJECT environment variable!`
);
assert(
process.env.GOOGLE_APPLICATION_CREDENTIALS,
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
);
});

describe('lookupEntry lookup', () => {
describe('lookupEntry lookup', done => {
it('should lookup a dataset entry', async () => {
const projectId = 'bigquery-public-data';
const datasetId = 'new_york_taxi_trips';
const output = await tools.runAsync(
const expectedLinkedResource = `//bigquery.googleapis.com/projects/${projectId}/datasets/${datasetId}`;
exec(
`node lookupEntry.js ${projectId} ${datasetId}`,
cwd
{cwd},
(err, stdout) => {
assert.ok(stdout.includes(expectedLinkedResource));
done();
}
);
const expectedLinkedResource = `//bigquery.googleapis.com/projects/${projectId}/datasets/${datasetId}`;
assert.ok(output.includes(expectedLinkedResource));
});
});

0 comments on commit 79347de

Please sign in to comment.