Skip to content

Commit

Permalink
fix: missing mod event on immediate creation
Browse files Browse the repository at this point in the history
On create the state was being directly set, leading to a missing mod event.
fixes: CAS-948
  • Loading branch information
tiagolobocastro committed Jun 15, 2021
1 parent 6a2219b commit 9799302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion csi/moac/src/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export class Volume {
);
}
}
this.state = VolumeState.Healthy;
this._setState(VolumeState.Healthy);
log.info(`Volume "${this}" with ${this.spec.replicaCount} replica(s) and size ${this.size} was created`);
}

Expand Down
8 changes: 4 additions & 4 deletions csi/moac/test/volumes_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ module.exports = function () {
thin: false,
share: 'REPLICA_NONE'
});
expect(volEvents).to.have.lengthOf(2);
expect(volEvents).to.have.lengthOf(3);
});

it('should limit the size of created volume', async () => {
Expand Down Expand Up @@ -400,7 +400,7 @@ module.exports = function () {
thin: false,
share: 'REPLICA_NONE'
});
expect(volEvents).to.have.lengthOf(2);
expect(volEvents).to.have.lengthOf(3);
});

it('should fail if the size is zero', async () => {
Expand Down Expand Up @@ -449,7 +449,7 @@ module.exports = function () {
sinon.assert.notCalled(stub3);
expect(Object.keys(volume.replicas)).to.have.lengthOf(1);
expect(Object.values(volume.replicas)[0]).to.equal(replica);
expect(volEvents).to.have.lengthOf(2);
expect(volEvents).to.have.lengthOf(3);
expect(volEvents[0].eventType).to.equal('new');
expect(volEvents[1].eventType).to.equal('mod');
});
Expand Down Expand Up @@ -1989,7 +1989,7 @@ module.exports = function () {
expect(volume.replicas.node3.uuid).to.equal(UUID);
expect(volume.state).to.equal('healthy');

expect(volEvents).to.have.lengthOf(4);
expect(volEvents).to.have.lengthOf(5);
});

it('should publish the volume', async () => {
Expand Down

0 comments on commit 9799302

Please sign in to comment.