Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: snapshot.delete() no longer throws (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
chux0519 authored and stephenplusplus committed Jan 24, 2019
1 parent a089112 commit dfd6507
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Snapshot extends common.ServiceObject {
* @name Snapshot#compute
* @type {Compute}
*/
this.compute = isDisk ? scope.compute : scope;
this.compute = isDisk ? scope.zone.compute : scope;
/**
* @name Snapshot#name
* @type {string}
Expand Down
3 changes: 2 additions & 1 deletion system-test/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,13 @@ describe('Compute', () => {
return zone.disk(DISK_NAME).getMetadata();
});

it('should take a snapshot', async () => {
it('should take and delete a snapshot', async () => {
const [snapshot, operation] = await disk
.snapshot(generateName('snapshot'))
.create();
await operation.promise();
await snapshot.getMetadata();
await snapshot.delete();
});

it('should run operation as a promise', async () => {
Expand Down
5 changes: 5 additions & 0 deletions test/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,16 @@ describe('Snapshot', function() {
assert.strictEqual(this, scope);
done();
},
zone: {
compute: COMPUTE,
},
};

const snapshot = new Snapshot(scope, SNAPSHOT_NAME);
assert(snapshot instanceof ServiceObject);

assert.strictEqual(snapshot.compute, scope.zone.compute);

const calledWith = snapshot.calledWith_[0];
assert.strictEqual(calledWith.methods.create, true);

Expand Down

0 comments on commit dfd6507

Please sign in to comment.