Skip to content
39 changes: 29 additions & 10 deletions dataproc/system-test/createCluster.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,37 @@ const execSync = cmd =>
});

describe('create a dataproc cluster', () => {
it('should create a dataproc cluster', async () => {
const stdout = execSync(
`node createCluster.js "${projectId}" "${region}" "${clusterName}"`
);
assert.match(stdout, new RegExp(`${clusterName}`));
it('should create a dataproc cluster', async function () {
try {
const stdout = execSync(
`node createCluster.js "${projectId}" "${region}" "${clusterName}"`
);
assert.match(stdout, new RegExp(`${clusterName}`));
} catch (err) {
if (
err?.message?.includes('QUOTA') ||
err?.message?.includes('RESOURCE_EXHAUSTED') ||
err?.message?.includes('DISKS_TOTAL_GB')
) {
console.warn(
`Quota limit reached in project ${projectId}. Skipping test.`
);
this.skip();
Comment thread
angelcaamal marked this conversation as resolved.
} else {
throw err;
}
}
});

after(async () => {
await clusterClient.deleteCluster({
projectId: projectId,
region: region,
clusterName: clusterName,
});
try {
await clusterClient.deleteCluster({
projectId: projectId,
region: region,
clusterName: clusterName,
});
} catch (err) {
// Ignore errors during cleanup
}
});
});
27 changes: 21 additions & 6 deletions dataproc/system-test/instantiateInlineWorkflowTemplate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,26 @@ const {delay} = require('./util');

describe('instantiate an inline workflow template', () => {
it('should instantiate an inline workflow template', async function () {
this.retries(4);
await delay(this.test);
const stdout = execSync(
`node instantiateInlineWorkflowTemplate.js "${projectId}" "${region}"`
);
assert.match(stdout, /successfully/);
try {
this.retries(4);
await delay(this.test);
const stdout = execSync(
`node instantiateInlineWorkflowTemplate.js "${projectId}" "${region}"`
);
assert.match(stdout, /successfully/);
} catch (err) {
if (
err?.message?.includes('QUOTA') ||
err?.message?.includes('RESOURCE_EXHAUSTED') ||
err?.message?.includes('DISKS_TOTAL_GB')
) {
console.warn(
`Quota limit reached in project ${projectId}. Skipping test.`
);
this.skip();
} else {
throw err;
}
}
});
});
31 changes: 23 additions & 8 deletions dataproc/system-test/quickstart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,29 @@ describe('execute the quickstart', () => {
});

it('should execute the quickstart', async function () {
this.retries(4);
await delay(this.test);
const stdout = execSync(
`node quickstart.js "${projectId}" "${region}" "${clusterName}" "${jobFilePath}"`
);
assert.match(stdout, /Cluster created successfully/);
assert.match(stdout, /Job finished successfully/);
assert.match(stdout, /successfully deleted/);
try {
this.retries(4);
await delay(this.test);
const stdout = execSync(
`node quickstart.js "${projectId}" "${region}" "${clusterName}" "${jobFilePath}"`
);
assert.match(stdout, /Cluster created successfully/);
assert.match(stdout, /Job finished successfully/);
assert.match(stdout, /successfully deleted/);
} catch (err) {
if (
err?.message?.includes('QUOTA') ||
err?.message?.includes('RESOURCE_EXHAUSTED') ||
err?.message?.includes('DISKS_TOTAL_GB')
) {
console.warn(
`Quota limit reached in project ${projectId}. Skipping test.`
);
this.skip();
} else {
throw err;
}
}
});

afterEach(async () => {
Expand Down
35 changes: 27 additions & 8 deletions dataproc/system-test/submitJob.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,24 @@ const execSync = cmd =>
});

describe('submit a Spark job to a Dataproc cluster', () => {
before(async () => {
const [operation] = await clusterClient.createCluster(cluster);
await operation.promise();
before(async function () {
try {
const [operation] = await clusterClient.createCluster(cluster);
await operation.promise();
} catch (err) {
if (
err?.message?.includes('QUOTA') ||
err?.message?.includes('RESOURCE_EXHAUSTED') ||
err?.message?.includes('DISKS_TOTAL_GB')
) {
console.warn(
`Quota limit reached in project ${projectId}. Skipping test.`
);
this.skip();
Comment thread
angelcaamal marked this conversation as resolved.
} else {
throw err;
}
}
});

it('should submit a job to a dataproc cluster', async () => {
Expand All @@ -64,10 +79,14 @@ describe('submit a Spark job to a Dataproc cluster', () => {
});

after(async () => {
await clusterClient.deleteCluster({
projectId: projectId,
region: region,
clusterName: clusterName,
});
try {
await clusterClient.deleteCluster({
projectId: projectId,
region: region,
clusterName: clusterName,
});
} catch (err) {
// Ignore errors during cleanup
}
});
});
Loading