Skip to content

Commit

Permalink
fix(#8940): fix upgrade version check
Browse files Browse the repository at this point in the history
  • Loading branch information
dianabarsan authored Apr 15, 2024
1 parent 1422e29 commit dbc697f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion admin/src/js/controllers/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ angular.module('controllers').controller('UpgradeCtrl',
.get('/api/deploy-info')
.then(({ data: deployInfo }) => {
if (expectUpgrade) {
if (expectedVersion === deployInfo.version) {
if (expectedVersion === deployInfo.build) {
return reloadPage();
}
logError('instance.upgrade.error.deploy', 'instance.upgrade.error.deploy');
Expand Down
16 changes: 8 additions & 8 deletions admin/tests/unit/controllers/upgrade.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,15 @@ describe('UpgradeCtrl controller', () => {
it('should continue following when request errors', async () => {
const deployInfo = { the: 'deplopy info', version: '4.1.0' };
const upgradeDoc = {
from: { version: '4.1.0', build: '4.1.0' },
to: { version: '4.2.0', build: '4.2.0' },
from: { version: '4.1.0', build: '4.1.0.113' },
to: { version: '4.2.0', build: '4.2.0..114' },
};
Object.freeze(deployInfo);
Object.freeze(upgradeDoc);

http.get.withArgs('/api/deploy-info')
.onCall(0).resolves({ data: deployInfo })
.onCall(1).resolves({ data: { the: 'deplopy info', version: '4.2.0' } });
.onCall(1).resolves({ data: { the: 'deplopy info', version: '4.2.0', build: '4.2.0..114' } });
http.get.withArgs('/api/v2/upgrade')
.onCall(0).resolves({ data: { upgradeDoc, indexers: [] } })
.onCall(1).rejects({ error: 502 })
Expand Down Expand Up @@ -508,19 +508,19 @@ describe('UpgradeCtrl controller', () => {
{ id: 'medic:medic:branch2', value: { version: 'branch2' } },
],
});
const deployInfo = { the: 'deplopy info', version: '4.1.0' };
const deployInfoUpgraded = { the: 'deplopy info', version: '4.2.0' };
const deployInfo = { the: 'deplopy info', version: '4.1.0', build: '4.1.0.123' };
const deployInfoUpgraded = { the: 'deplopy info', version: '4.2.0', build: '4.2.0.134' };
http.get.withArgs('/api/deploy-info')
.onCall(0).resolves({ data: deployInfo })
.onCall(1).resolves({ data: deployInfoUpgraded });
const upgradeDoc = {
from: {
version: '4.1.0',
build: '4.1.0',
build: '4.1.0.123',
},
to: {
version: '4.2.0',
build: '4.2.0',
build: '4.2.0.134',
}
};
http.get.withArgs('/api/v2/upgrade')
Expand Down Expand Up @@ -577,7 +577,7 @@ describe('UpgradeCtrl controller', () => {
{ id: 'medic:medic:branch2', value: { version: 'branch2' } },
],
});
const deployInfo = { the: 'deplopy info', version: '4.1.0' };
const deployInfo = { the: 'deplopy info', version: '4.1.0', build: '4.1.0.234' };
http.get.withArgs('/api/deploy-info').resolves({ data: deployInfo });
http.get.withArgs('/api/v2/upgrade')
.onCall(0).resolves({ data: { upgradeDoc: undefined } })
Expand Down

0 comments on commit dbc697f

Please sign in to comment.