16
16
17
17
const path = require ( 'path' ) ;
18
18
const assert = require ( 'assert' ) ;
19
- const tools = require ( '@google-cloud/nodejs-repo-tools' ) ;
20
19
const uuid = require ( 'uuid' ) ;
21
20
const cwd = path . join ( __dirname , '..' ) ;
21
+ const { exec} = require ( 'child_process' ) ;
22
22
23
23
const projectId = process . env . GCLOUD_PROJECT ;
24
24
// Use unique id to avoid conflicts between concurrent test runs
@@ -29,24 +29,33 @@ const location = 'us-central1';
29
29
const { DataCatalogClient} = require ( '@google-cloud/datacatalog' ) . v1beta1 ;
30
30
const datacatalog = new DataCatalogClient ( ) ;
31
31
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
+ } ) ;
33
42
34
43
describe ( 'createFilesetEntry' , ( ) => {
35
- before ( async ( ) => {
44
+ before ( done => {
36
45
// 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 ) ;
41
47
} ) ;
42
48
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 (
45
52
`node createFilesetEntry.js ${ projectId } ${ entryGroupId } ${ entryId } ` ,
46
- cwd
53
+ { cwd} ,
54
+ ( err , stdout ) => {
55
+ assert . ok ( stdout . includes ( expectedLinkedResource ) ) ;
56
+ done ( ) ;
57
+ }
47
58
) ;
48
- const expectedLinkedResource = `//datacatalog.googleapis.com/projects/${ projectId } /locations/${ location } /entryGroups/${ entryGroupId } /entries/${ entryId } ` ;
49
- assert . ok ( output . includes ( expectedLinkedResource ) ) ;
50
59
} ) ;
51
60
52
61
after ( async ( ) => {
0 commit comments