Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/config/nodejs-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"cloudbuild",
"composer",
"composer/functions/composer-storage-trigger",
"compute",
Comment on lines 111 to +112
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding 'compute' here will include it in the development CI runs. Ensure this is the desired behavior and that the compute sample is ready for these runs.

   "compute",

"contact-center-insights",
"container",
"container-analysis/snippets",
Expand Down
1 change: 0 additions & 1 deletion .github/config/nodejs-prod.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"automl", // (untested) FAILED_PRECONDITION: Google Cloud AutoML Natural Language was retired on March 15, 2024. Please migrate to Vertex AI instead
"cloud-sql/sqlserver/mssql", // (untested) TypeError: The "config.server" property is required and must be of type string.
"cloud-sql/sqlserver/tedious", // (untested) TypeError: The "config.server" property is required and must be of type string.
"compute", // GoogleError: The resource 'projects/long-door-651/zones/us-central1-a/disks/disk-from-pool-name' was not found
Comment on lines 81 to -82
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Removing 'compute' from the production CI runs suggests there were issues with it. Ensure the comment accurately reflects the reason for removal and that there's a plan to re-enable it once the issues are resolved.

    "compute", // GoogleError: The resource 'projects/long-door-651/zones/us-central1-a/disks/disk-from-pool-name' was not found

"dataproc", // GoogleError: Error submitting create cluster request: Multiple validation errors
"datastore/functions", // [ERR_REQUIRE_ESM]: require() of ES Module
"dialogflow-cx", // NOT_FOUND: com.google.apps.framework.request.NotFoundException: Agent 'undefined' does not exist
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/compute.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions compute/ci-setup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

{
"_justification": "Compute tests take longer to run",
"timeout-minutes": 120
}
3 changes: 2 additions & 1 deletion compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"*.js"
],
"scripts": {
"test": "c8 mocha -p -j 2 test --timeout 1200000"
"test-only": "mocha --timeout 1000000 -g",
"test": "c8 mocha -p -j 4 test --timeout 1100000"
},
"dependencies": {
"@google-cloud/compute": "^4.0.0",
Expand Down
29 changes: 13 additions & 16 deletions compute/test/createInstanceReplicatedBootDisk.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
const path = require('path');
const assert = require('node:assert/strict');
const uuid = require('uuid');
const {after, before, describe, it} = require('mocha');
const {describe, it} = require('mocha');
const cp = require('child_process');
const computeLib = require('@google-cloud/compute');
const {getStaleVMInstances, deleteInstance} = require('./util');
Expand Down Expand Up @@ -118,28 +118,15 @@ describe('Create compute instance with replicated boot disk', async () => {
let projectId;
let diskSnapshotLink;

before(async () => {
it('should create an instance with replicated boot disk', async () => {
// before
const instancesClient = new computeLib.InstancesClient();
projectId = await instancesClient.getProjectId();
diskSnapshotLink = `projects/${projectId}/global/snapshots/${snapshotName}`;

await createDisk(projectId, zone1, diskName);
await createDiskSnapshot(projectId, zone1, diskName, snapshotName);
});

after(async () => {
// Cleanup resources
const instances = await getStaleVMInstances();
await Promise.all(
instances.map(instance =>
deleteInstance(instance.zone, instance.instanceName)
)
);
await deleteDiskSnapshot(projectId, snapshotName);
await deleteDisk(projectId, zone1, diskName);
});

it('should create an instance with replicated boot disk', () => {
const response = execSync(
`node ./instances/create-start-instance/createInstanceReplicatedBootDisk.js ${zone1} ${zone2} ${vmName} ${diskSnapshotLink}`,
{
Expand All @@ -152,5 +139,15 @@ describe('Create compute instance with replicated boot disk', async () => {
`Instance: ${vmName} with replicated boot disk created.`
)
);

// after Cleanup resources
await deleteDiskSnapshot(projectId, snapshotName);
await deleteDisk(projectId, zone1, diskName);
const instances = await getStaleVMInstances();
await Promise.all(
instances.map(instance =>
deleteInstance(instance.zone, instance.instanceName)
)
);
});
});
32 changes: 16 additions & 16 deletions compute/test/replicatedDisk.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
const path = require('path');
const assert = require('node:assert/strict');
const uuid = require('uuid');
const {after, before, describe, it} = require('mocha');
const {describe, it} = require('mocha');
const cp = require('child_process');
const computeLib = require('@google-cloud/compute');

Expand Down Expand Up @@ -57,31 +57,21 @@
const zone2 = `${region}-b`;
let projectId;

before(async () => {
it('should create a regional replicated disk and attach to vm', async () => {
const instancesClient = new computeLib.InstancesClient();
projectId = await instancesClient.getProjectId();
});

after(async () => {
// Cleanup resources
execSync(`node ./deleteInstance.js ${projectId} ${zone1} ${vmName}`, {
cwd,
});
await deleteDisk(projectId, region, diskName);
});

it('should create a regional replicated disk', () => {
const response = execSync(
`node ./disks/createRegionalReplicatedDisk.js ${diskName} ${region} ${zone1} ${zone2}`,
{
cwd,
}
);

console.log(`replicatedDisk.tests.js: Disk ${diskName} created.`);

assert(response.includes(`Regional replicated disk: ${diskName} created.`));
});

it('should attach replicated disk to vm', () => {
// Create VM, where replicated disk will be attached.
execSync(
`node ./createInstance.js ${projectId} ${zone1} ${vmName} e2-small`,
Expand All @@ -90,17 +80,27 @@
}
);

const response = execSync(
console.log(`replicatedDisk.tests.js: Instance ${vmName} created.`);

const responseAttach = execSync(
`node ./disks/attachRegionalDisk.js ${diskName} ${region} ${vmName} ${zone1}`,
{
cwd,
}
);

console.log(`replicatedDisk.tests.js: Disk ${diskName} attached to ${vmName}.`);

Check failure on line 92 in compute/test/replicatedDisk.test.js

View workflow job for this annotation

GitHub Actions / lint

Replace ``replicatedDisk.tests.js:·Disk·${diskName}·attached·to·${vmName}.`` with `⏎······`replicatedDisk.tests.js:·Disk·${diskName}·attached·to·${vmName}.`⏎····`

assert(
response.includes(
responseAttach.includes(
`Replicated disk: ${diskName} attached to VM: ${vmName}.`
)
);

// Cleanup resources
execSync(`node ./deleteInstance.js ${projectId} ${zone1} ${vmName}`, {
cwd,
});
await deleteDisk(projectId, region, diskName);
});
});
Loading