Merge pull request #1920 from balena-os/eval-download-progress-correctly

Correctly evaluate downloadProgress when computing current state
This commit is contained in:
bulldozer-balena[bot] 2022-04-08 02:56:14 +00:00 committed by GitHub
commit c5f40b4c83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -1041,7 +1041,9 @@ export async function getState() {
commit, commit,
serviceName, serviceName,
status: status as string, status: status as string,
...(downloadProgress && { download_progress: downloadProgress }), ...(Number.isInteger(downloadProgress) && {
download_progress: downloadProgress,
}),
}), }),
); );

View File

@ -1373,6 +1373,14 @@ describe('compose/application-manager', () => {
serviceName: 'ubuntu', serviceName: 'ubuntu',
status: 'Downloaded', status: 'Downloaded',
}, },
{
name: 'node:latest',
commit: 'latestrelease',
appUuid: 'myapp',
serviceName: 'node',
status: 'Downloading',
downloadProgress: 0,
},
{ {
name: 'alpine:latest', name: 'alpine:latest',
commit: 'latestrelease', commit: 'latestrelease',
@ -1427,6 +1435,11 @@ describe('compose/application-manager', () => {
status: 'Downloading', status: 'Downloading',
download_progress: 50, download_progress: 50,
}, },
node: {
image: 'node:latest',
status: 'Downloading',
download_progress: 0,
},
}, },
}, },
}, },