-
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 all 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 {execSync} = require('child_process'); | ||
|
|
||
| const cwd = path.join(__dirname, '..'); | ||
| const projectId = process.env.GCLOUD_PROJECT; | ||
|
|
@@ -36,35 +36,35 @@ before(() => { | |
| `Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!` | ||
| ); | ||
| }); | ||
| after(async () => { | ||
| after(() => { | ||
| try { | ||
| await tools.runAsync( | ||
| execSync( | ||
| `node deleteDataset.js ${projectId} ${cloudRegion} ${destinationDatasetId}`, | ||
| cwd | ||
| ); | ||
| // eslint-disable-next-line no-empty | ||
| } catch (err) {} // Ignore error | ||
| }); | ||
|
|
||
| it('should create a dataset', async () => { | ||
| const output = await tools.runAsync( | ||
| it('should create a dataset', () => { | ||
| const output = 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( | ||
| it('should get a dataset', () => { | ||
| const output = execSync( | ||
| `node getDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('name')); | ||
| }); | ||
|
|
||
| it('should patch a dataset', async () => { | ||
| it('should patch a dataset', () => { | ||
| const timeZone = 'GMT'; | ||
| const output = await tools.runAsync( | ||
| const output = execSync( | ||
| `node patchDataset.js ${projectId} ${cloudRegion} ${datasetId} ${timeZone}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -74,16 +74,16 @@ it('should patch a dataset', async () => { | |
| ); | ||
| }); | ||
|
|
||
| it('should list datasets', async () => { | ||
| const output = await tools.runAsync( | ||
| it('should list datasets', () => { | ||
| const output = 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( | ||
| it('should de-identify data in a dataset and write to a new dataset', () => { | ||
| const output = execSync( | ||
| `node deidentifyDataset.js ${projectId} ${cloudRegion} ${datasetId} ${destinationDatasetId} ${keeplistTags}`, | ||
| cwd | ||
| ); | ||
|
|
@@ -93,24 +93,24 @@ it('should de-identify data in a dataset and write to a new dataset', async () = | |
| ); | ||
| }); | ||
|
|
||
| it('should create and get a dataset IAM policy', async () => { | ||
| it('should create and get a dataset IAM policy', () => { | ||
| const localMember = 'group:[email protected]'; | ||
| const localRole = 'roles/viewer'; | ||
|
|
||
| let output = await tools.runAsync( | ||
| let output = execSync( | ||
| `node setDatasetIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${localMember} ${localRole}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes, 'ETAG'); | ||
|
|
||
| output = await tools.runAsync( | ||
| output = execSync( | ||
| `node getDatasetIamPolicy.js ${projectId} ${cloudRegion} ${datasetId}` | ||
| ); | ||
| assert.ok(output.includes('dpebot')); | ||
| }); | ||
|
|
||
| it('should delete a dataset', async () => { | ||
| const output = await tools.runAsync( | ||
| it('should delete a dataset', () => { | ||
| const output = 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 {execSync} = 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( | ||
| execSync( | ||
| `node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwdDatasets | ||
| ); | ||
|
|
@@ -75,79 +75,79 @@ after(async () => { | |
|
|
||
| await pubSubClient.topic(topicName).delete(); | ||
| console.log(`Topic ${topicName} deleted.`); | ||
| await tools.runAsync( | ||
| execSync( | ||
| `node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwdDatasets | ||
| ); | ||
| } catch (err) {} // Ignore error | ||
| }); | ||
|
|
||
| it('should create a DICOM store', async () => { | ||
| const output = await tools.runAsync( | ||
| it('should create a DICOM store', () => { | ||
| const output = 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( | ||
| it('should get a DICOM store', () => { | ||
| const output = 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( | ||
| it('should patch a DICOM store', () => { | ||
| const output = 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( | ||
| it('should list DICOM stores', () => { | ||
| const output = execSync( | ||
| `node listDicomStores.js ${projectId} ${cloudRegion} ${datasetId}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes('dicomStores')); | ||
| }); | ||
|
|
||
| it('should create and get a DICOM store IAM policy', async () => { | ||
| it('should create and get a DICOM store IAM policy', () => { | ||
| const localMember = 'group:[email protected]'; | ||
| const localRole = 'roles/viewer'; | ||
|
|
||
| let output = await tools.runAsync( | ||
| let output = execSync( | ||
| `node setDicomStoreIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${localMember} ${localRole}`, | ||
| cwd | ||
| ); | ||
| assert.ok(output.includes, 'ETAG'); | ||
|
|
||
| output = await tools.runAsync( | ||
| output = 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( | ||
| it('should import a DICOM object from GCS', () => { | ||
| const output = 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( | ||
| it('should export a DICOM instance', () => { | ||
| const output = 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( | ||
| it('should delete a DICOM store', () => { | ||
| const output = execSync( | ||
| `node deleteDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`, | ||
| cwd | ||
| ); | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍