From b082afe7b5db2d3e199c169b97bbf3de95421842 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Thu, 17 Oct 2024 14:17:21 +0700 Subject: [PATCH] fix: drive status report --- packages/dashmate/src/status/determineStatus.js | 4 ++++ .../dashmate/test/unit/status/scopes/platform.spec.js | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/dashmate/src/status/determineStatus.js b/packages/dashmate/src/status/determineStatus.js index 723302a006..b089f1f7f7 100644 --- a/packages/dashmate/src/status/determineStatus.js +++ b/packages/dashmate/src/status/determineStatus.js @@ -49,6 +49,10 @@ export default { return coreIsSynced ? ServiceStatusEnum.up : ServiceStatusEnum.wait_for_core; } + if (dockerStatus === DockerStatusEnum.not_started) { + return ServiceStatusEnum.stopped; + } + return ServiceStatusEnum.error; }, }; diff --git a/packages/dashmate/test/unit/status/scopes/platform.spec.js b/packages/dashmate/test/unit/status/scopes/platform.spec.js index c3a1c28ff1..b94f0da636 100644 --- a/packages/dashmate/test/unit/status/scopes/platform.spec.js +++ b/packages/dashmate/test/unit/status/scopes/platform.spec.js @@ -1,3 +1,5 @@ +import ContainerIsNotPresentError + from '../../../../src/docker/errors/ContainerIsNotPresentError.js'; import providers from '../../../../src/status/providers.js'; import determineStatus from '../../../../src/status/determineStatus.js'; import getConfigMock from '../../../../src/test/mock/getConfigMock.js'; @@ -377,7 +379,7 @@ describe('getPlatformScopeFactory', () => { mockDetermineDockerStatus.withArgs(mockDockerCompose, config, 'drive_tenderdash') .returns(DockerStatusEnum.running); mockDetermineDockerStatus.withArgs(mockDockerCompose, config, 'drive_abci') - .throws(); + .throws(new ContainerIsNotPresentError('drive_abci')); mockDockerCompose.execCommand.returns({ exitCode: 0, out: '' }); mockMNOWatchProvider.returns(Promise.resolve('OPEN')); @@ -430,8 +432,8 @@ describe('getPlatformScopeFactory', () => { network: 'test', }, drive: { - dockerStatus: null, - serviceStatus: null, + dockerStatus: DockerStatusEnum.not_started, + serviceStatus: ServiceStatusEnum.stopped, }, };