Skip to content
6 changes: 3 additions & 3 deletions auth/system-test/auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

const path = require('path');
const assert = require('assert');
const tools = require('@google-cloud/nodejs-repo-tools');
const childProcess = require('child_process');

const cwd = path.join(__dirname, '..');
const cmd = 'node auth.js';
Expand All @@ -35,15 +35,15 @@ before(() => {
});

it('should load credentials implicitly', async () => {
const output = await tools.runAsync(`${cmd} auth-cloud-implicit`, cwd);
const output = await childProcess.execSync(`${cmd} auth-cloud-implicit`, cwd);
assert.strictEqual(output.includes(BUCKET_NAME), true);
});

it('should load credentials explicitly', async () => {
const project = process.env.GCLOUD_PROJECT;
const keyfile = process.env.GOOGLE_APPLICATION_CREDENTIALS;
console.log(`${cmd} auth-cloud-explicit -p ${project} -k ${keyfile}`);
const output = await tools.runAsync(
const output = await childProcess.execSync(
`${cmd} auth-cloud-explicit -p ${project} -k ${keyfile}`,
cwd
);
Expand Down
12 changes: 6 additions & 6 deletions endpoints/getting-started-grpc/system-test/endpoints.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ const JWT_AUTH_TOKEN = jwt.sign(

// API key
it(`should request a greeting from a remote Compute Engine instance using an API key`, async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`${clientCmd} -h ${GCE_HOST} -k ${API_KEY}`,
cwd
);
assert.ok(new RegExp('Hello world').test(output));
});

it(`should request a greeting from a remote Container Engine cluster using an API key`, async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`${clientCmd} -h ${GKE_HOST} -k ${API_KEY}`,
cwd
);
Expand All @@ -93,7 +93,7 @@ it('should request and handle a greeting locally using an API key', async () =>
const server = childProcess.exec(`${serverCmd} -p ${PORT}`, {cwd: cwd});

await delay(1000);
const clientOutput = await tools.runAsync(
const clientOutput = await childProcess.execSync(
`${clientCmd} -h localhost:${PORT} -k ${API_KEY}`,
cwd
);
Expand All @@ -103,15 +103,15 @@ it('should request and handle a greeting locally using an API key', async () =>

// Authtoken
it(`should request a greeting from a remote Compute Engine instance using a JWT Auth Token`, async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`${clientCmd} -h ${GCE_HOST} -j ${JWT_AUTH_TOKEN}`,
cwd
);
assert.ok(new RegExp('Hello world').test(output));
});

it(`should request a greeting from a remote Container Engine cluster using a JWT Auth Token`, async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`${clientCmd} -h ${GKE_HOST} -j ${JWT_AUTH_TOKEN}`,
cwd
);
Expand All @@ -123,7 +123,7 @@ it(`should request and handle a greeting locally using a JWT Auth Token`, async
const server = childProcess.exec(`${serverCmd} -p ${PORT}`, {cwd: cwd});

await delay(1000);
const clientOutput = await tools.runAsync(
const clientOutput = await childProcess.execSync(
`${clientCmd} -h localhost:${PORT} -j ${JWT_AUTH_TOKEN}`,
cwd
);
Expand Down
20 changes: 10 additions & 10 deletions healthcare/datasets/system-test/datasets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +38,7 @@ before(() => {
});
after(async () => {
try {
await tools.runAsync(
await childProcess.execSync(
`node deleteDataset.js ${projectId} ${cloudRegion} ${destinationDatasetId}`,
cwd
);
Expand All @@ -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
);
Expand All @@ -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
);
Expand All @@ -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
);
Expand All @@ -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
);
Expand Down
24 changes: 12 additions & 12 deletions healthcare/dicom/system-test/dicom_stores.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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
);
Expand All @@ -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
);
Expand All @@ -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
);
Expand Down
27 changes: 15 additions & 12 deletions healthcare/dicom/system-test/dicomweb.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 projectId = process.env.GCLOUD_PROJECT;
const cloudRegion = 'us-central1';
Expand Down Expand Up @@ -50,75 +50,78 @@ before(async () => {
process.env.GOOGLE_APPLICATION_CREDENTIALS,
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
);
await tools.runAsync(
await childProcess.execSync(
`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
cwdDatasets
);
await tools.runAsync(
await childProcess.execSync(
`node createDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`,
cwd
);
});
after(async () => {
try {
await tools.runAsync(
await childProcess.execSync(
`node deleteDicomStore.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`,
cwd
);
await tools.runAsync(`node deleteDataset.js ${datasetId}`, cwdDatasets);
await childProcess.execSync(
`node deleteDataset.js ${datasetId}`,
cwdDatasets
);
} catch (err) {} // Ignore error
});

it('should store a DICOM instance', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebStoreInstance.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${dcmFile}`,
cwd
);
assert.ok(output.includes('Stored DICOM instance'));
});

it('should search DICOM instances', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebSearchForInstances.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`,
cwd
);
assert.ok(output.includes('Found'));
});

it('should retrieve a DICOM study', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebRetrieveStudy.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${studyUid}`,
cwd
);
assert.ok(output.includes('Retrieved study'));
});

it('should retrieve a DICOM instance', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebRetrieveInstance.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${studyUid} ${seriesUid} ${instanceUid}`,
cwd
);
assert.ok(output.includes('Retrieved DICOM instance'));
});

it('should retrieve a DICOM rendered PNG image', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebRetrieveRendered.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${studyUid} ${seriesUid} ${instanceUid}`,
cwd
);
assert.ok(output.includes('Retrieved rendered image'));
});

it('should search for DICOM studies', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebSearchStudies.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId}`,
cwd
);
assert.ok(output.includes('Found'));
});

it('should delete a DICOM study', async () => {
const output = await tools.runAsync(
const output = await childProcess.execSync(
`node dicomWebDeleteStudy.js ${projectId} ${cloudRegion} ${datasetId} ${dicomStoreId} ${studyUid}`,
cwd
);
Expand Down
Loading