-
Notifications
You must be signed in to change notification settings - Fork 2k
chore: replace repo tools tools.runAsync function with execSync #1597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fhinkel
merged 11 commits into
GoogleCloudPlatform:master
from
sofisl:removeRepoToolsFromTests
Feb 3, 2020
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
19214f6
chore: refactor tools.runAsync with execSync
sofisl e61b44a
fix: run lint
sofisl 87ab2c5
push child process fix
sofisl b6c6e61
Merge branch 'master' of github.com:GoogleCloudPlatform/nodejs-docs-s…
sofisl 68176c1
fix: npm run lint
sofisl f1ac90a
fix: failing iot test
sofisl 4635059
fix: failling test
sofisl 6eaa1c0
remove async/async functions, run lint
sofisl 0c05613
fix: missing .only
sofisl beffc00
fix: destructuring object
sofisl 763cb9c
fix: npm run lint
sofisl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ | |
|
|
||
| const path = require('path'); | ||
| const assert = require('assert'); | ||
| const tools = require('@google-cloud/nodejs-repo-tools'); | ||
| const uuid = require('uuid'); | ||
| const childProcess = require('child_process'); | ||
|
|
||
| const cwd = path.join(__dirname, '..'); | ||
| const projectId = process.env.GCLOUD_PROJECT; | ||
|
|
@@ -38,7 +38,7 @@ before(() => { | |
| }); | ||
| after(async () => { | ||
| try { | ||
| await tools.runAsync( | ||
| await childProcess.execSync( | ||
| `node deleteDataset.js ${projectId} ${cloudRegion} ${destinationDatasetId}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -47,15 +47,15 @@ after(async () => { | |
| }); | ||
|
|
||
| it('should create a dataset', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwd | ||
| ); | ||
| assert.strictEqual(output, `Created dataset: ${datasetId}`); | ||
| }); | ||
|
|
||
| it('should get a dataset', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node getDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -64,7 +64,7 @@ it('should get a dataset', async () => { | |
|
|
||
| it('should patch a dataset', async () => { | ||
| const timeZone = 'GMT'; | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node patchDataset.js ${projectId} ${cloudRegion} ${datasetId} ${timeZone}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -75,15 +75,15 @@ it('should patch a dataset', async () => { | |
| }); | ||
|
|
||
| it('should list datasets', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node listDatasets.js ${projectId} ${cloudRegion}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('datasets')); | ||
| }); | ||
|
|
||
| it('should de-identify data in a dataset and write to a new dataset', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node deidentifyDataset.js ${projectId} ${cloudRegion} ${datasetId} ${destinationDatasetId} ${keeplistTags}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -97,20 +97,20 @@ it('should create and get a dataset IAM policy', async () => { | |
| const localMember = 'group:[email protected]'; | ||
| const localRole = 'roles/viewer'; | ||
|
|
||
| let output = await tools.runAsync( | ||
| let output = await childProcess.execSync( | ||
| `node setDatasetIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${localMember} ${localRole}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes, 'ETAG'); | ||
|
|
||
| output = await tools.runAsync( | ||
| output = await childProcess.execSync( | ||
| `node getDatasetIamPolicy.js ${projectId} ${cloudRegion} ${datasetId}` | ||
| ); | ||
| assert.ok(output.includes('dpebot')); | ||
| }); | ||
|
|
||
| it('should delete a dataset', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwd | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,8 @@ | |
|
|
||
| const path = require('path'); | ||
| const assert = require('assert'); | ||
| const tools = require('@google-cloud/nodejs-repo-tools'); | ||
| const uuid = require('uuid'); | ||
| const childProcess = require('child_process'); | ||
|
|
||
| const {PubSub} = require('@google-cloud/pubsub'); | ||
| const {Storage} = require('@google-cloud/storage'); | ||
|
|
@@ -59,7 +59,7 @@ before(async () => { | |
| // Create a Pub/Sub topic to be used for testing. | ||
| const [topic] = await pubSubClient.createTopic(topicName); | ||
| console.log(`Topic ${topic.name} created.`); | ||
| await tools.runAsync( | ||
| await childProcess.execSync( | ||
| `node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwdDatasets | ||
| ); | ||
|
|
@@ -75,39 +75,39 @@ after(async () => { | |
|
|
||
| await pubSubClient.topic(topicName).delete(); | ||
| console.log(`Topic ${topicName} deleted.`); | ||
| await tools.runAsync( | ||
| await childProcess.execSync( | ||
| `node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwdDatasets | ||
| ); | ||
| } catch (err) {} // Ignore error | ||
| }); | ||
|
|
||
| it('should create a DICOM store', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node createDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('Created DICOM store')); | ||
| }); | ||
|
|
||
| it('should get a DICOM store', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node getDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('name')); | ||
| }); | ||
|
|
||
| it('should patch a DICOM store', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node patchDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${topicName}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('Patched DICOM store')); | ||
| }); | ||
|
|
||
| it('should list DICOM stores', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node listDicomStores.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -118,36 +118,36 @@ it('should create and get a DICOM store IAM policy', async () => { | |
| const localMember = 'group:[email protected]'; | ||
| const localRole = 'roles/viewer'; | ||
|
|
||
| let output = await tools.runAsync( | ||
| let output = await childProcess.execSync( | ||
| `node setDicomStoreIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${localMember} ${localRole}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes, 'ETAG'); | ||
|
|
||
| output = await tools.runAsync( | ||
| output = await childProcess.execSync( | ||
| `node getDicomStoreIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}` | ||
| ); | ||
| assert.ok(output.includes('dpebot')); | ||
| }); | ||
|
|
||
| it('should import a DICOM object from GCS', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node importDicomInstance.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${gcsUri}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('Successfully imported DICOM instances')); | ||
| }); | ||
|
|
||
| it('should export a DICOM instance', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node exportDicomInstanceGcs.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${bucketName}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('Exported DICOM instances')); | ||
| }); | ||
|
|
||
| it('should delete a DICOM store', async () => { | ||
| const output = await tools.runAsync( | ||
| const output = await childProcess.execSync( | ||
| `node deleteDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`, | ||
| cwd | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.