Skip to content

Commit 8a5b414

Browse files
author
Joanna Grycz
committed
Fix for createComputeHyperdiskPool.test.js
1 parent b14df12 commit 8a5b414

File tree

4 files changed

+15
-96
lines changed

4 files changed

+15
-96
lines changed

compute/disks/createComputeHyperdiskFromPool.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ async function main() {
3535
// The zone where your VM and new disk are located.
3636
const zone = 'europe-central2-b';
3737
// The name of the new disk
38-
const diskName = 'disk-name-from-pool';
38+
const diskName = 'disk-from-pool-name';
3939
// The name of the storage pool
40-
const storagePoolName = 'storage-pool-name-hyperdisk';
40+
const storagePoolName = 'storage-pool-name';
4141
// Link to the storagePool you want to use. Use format:
4242
// https://www.googleapis.com/compute/v1/projects/{projectId}/zones/{zone}/storagePools/{storagePoolName}
4343
const storagePool = `https://www.googleapis.com/compute/v1/projects/${projectId}/zones/${zone}/storagePools/${storagePoolName}`;

compute/disks/createComputeHyperdiskPool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function main() {
3333
// Project ID or project number of the Google Cloud project you want to use.
3434
const projectId = await storagePoolClient.getProjectId();
3535
// Name of the zone in which you want to create the storagePool.
36-
const zone = 'us-central1-a';
36+
const zone = 'europe-central2-b';
3737
// Name of the storagePool you want to create.
3838
const storagePoolName = 'storage-pool-name';
3939
// The type of disk you want to create. This value uses the following format:

compute/test/createComputeHyperdiskFromPool.test.js

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ async function cleanupResources(projectId, zone, diskName, storagePoolName) {
6666
}
6767

6868
describe('Create compute hyperdisk from pool', async () => {
69-
const diskName = 'disk-name-from-pool';
69+
const diskName = 'disk-from-pool-name';
7070
const zone = 'europe-central2-b';
71-
const storagePoolName = 'storage-pool-name-hyperdisk';
71+
const storagePoolName = 'storage-pool-name';
7272
const disksClient = new DisksClient();
73-
const storagePoolsClient = new StoragePoolsClient();
74-
const zoneOperationsClient = new ZoneOperationsClient();
7573
let projectId;
7674

7775
before(async () => {
@@ -84,36 +82,22 @@ describe('Create compute hyperdisk from pool', async () => {
8482
// Should be ok to ignore (resources do not exist)
8583
console.error(err);
8684
}
87-
88-
const [response] = await storagePoolsClient.insert({
89-
project: projectId,
90-
storagePoolResource: {
91-
name: storagePoolName,
92-
poolProvisionedCapacityGb: 10240,
93-
poolProvisionedIops: 10000,
94-
poolProvisionedThroughput: 1024,
95-
storagePoolType: `projects/${projectId}/zones/${zone}/storagePoolTypes/hyperdisk-balanced`,
96-
capacityProvisioningType: 'advanced',
97-
zone,
98-
},
99-
zone,
100-
});
101-
let operation = response.latestResponse;
102-
103-
// Wait for the insert pool operation to complete.
104-
while (operation.status !== 'DONE') {
105-
[operation] = await zoneOperationsClient.wait({
106-
operation: operation.name,
107-
project: projectId,
108-
zone: operation.zone.split('/').pop(),
109-
});
110-
}
11185
});
11286

11387
after(async () => {
11488
await cleanupResources(projectId, zone, diskName, storagePoolName);
11589
});
11690

91+
it('should create a new storage pool', () => {
92+
const response = JSON.parse(
93+
execSync('node ./disks/createComputeHyperdiskPool.js', {
94+
cwd,
95+
})
96+
);
97+
98+
assert.equal(response.name, storagePoolName);
99+
});
100+
117101
it('should create a new hyperdisk from pool', () => {
118102
const response = JSON.parse(
119103
execSync('node ./disks/createComputeHyperdiskFromPool.js', {

compute/test/createComputeHyperdiskPool.test.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)