This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Master] Allow upgrade from 0.19.x (#4612)
Signed-off-by: Dave Kelsey <[email protected]>
- Loading branch information
Dave Kelsey
authored
Mar 7, 2019
1 parent
a7b8ed3
commit ac291c6
Showing
3 changed files
with
12 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,17 +233,21 @@ describe('Engine', () => { | |
sinon.assert.calledOnce(mockContext.transactionEnd); | ||
}); | ||
|
||
it('should throw error if upgrade not allowed', async () => { | ||
it('should NOT throw error if upgrading from a much older version', async () => { | ||
const sysdata = sinon.createStubInstance(DataCollection); | ||
mockContainer.getVersion.returns('0.21.0'); | ||
await engine.upgrade(mockContext, '', sysdata, {runtimeVersion:'0.20.0'}); | ||
sinon.assert.calledOnce(sysdata.update); | ||
sinon.assert.calledWith(sysdata.update, 'metanetwork', { | ||
'$class': 'org.hyperledger.composer.system.Network', | ||
'networkId': '[email protected]', | ||
'runtimeVersion': '0.21.0' | ||
}); | ||
sinon.assert.calledOnce(mockRegistryManager.createDefaults); | ||
sinon.assert.calledOnce(mockContext.transactionPrepare); | ||
sinon.assert.calledOnce(mockContext.transactionCommit); | ||
sinon.assert.calledOnce(mockContext.transactionEnd); | ||
|
||
try { | ||
await engine.upgrade(mockContext, '', sysdata, {runtimeVersion:'0.20.0'}); | ||
should.fail('Expected error to be thrown'); | ||
} catch(err) { | ||
err.message.should.match(/Cannot upgrade/); | ||
sinon.assert.notCalled(sysdata.update); | ||
} | ||
}); | ||
|
||
it('should rollback if sysdata update fails', async () => { | ||
|