Merge pull request #2180 from balena-os/remove-stopped-service-status

Remove the 'Stopped' status for services
This commit is contained in:
flowzone-app[bot] 2023-06-28 21:00:11 +00:00 committed by GitHub
commit 00436ea160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 11 deletions

View File

@ -403,7 +403,7 @@ export class App {
// check that we want to stop it, and that it isn't stopped
return (
serviceTarget.config.running === false &&
serviceCurrent.status !== 'Stopped'
serviceCurrent.status !== 'exited'
);
};

View File

@ -40,7 +40,6 @@ const unsupportedSecurityOpt = (opt: string) => /label=.*/.test(opt);
export type ServiceStatus =
| 'Stopping'
| 'Stopped'
| 'Running'
| 'Installing'
| 'Installed'

View File

@ -1309,7 +1309,7 @@ describe('compose/application-manager', () => {
{
commit: 'oldrelease',
serviceName: 'fedora',
status: 'Stopped',
status: 'exited',
createdAt: new Date('2021-09-01T12:00:00'),
},
{
@ -1317,7 +1317,7 @@ describe('compose/application-manager', () => {
appUuid: 'debian',
commit: 'otherrelease',
serviceName: 'debian',
status: 'Stopped',
status: 'exited',
createdAt: new Date('2021-09-01T12:00:00'),
},
]);
@ -1351,7 +1351,7 @@ describe('compose/application-manager', () => {
services: {
fedora: {
image: 'fedora:older',
status: 'Stopped',
status: 'exited',
},
},
},

View File

@ -137,10 +137,10 @@ describe('manages application lifecycle', () => {
const isAllRunning = (ctns: Docker.ContainerInspectInfo[]) =>
ctns.every((ctn) => ctn.State.Running);
const isAllStopped = (ctns: Docker.ContainerInspectInfo[]) =>
const isAllExited = (ctns: Docker.ContainerInspectInfo[]) =>
ctns.every((ctn) => !ctn.State.Running);
const isSomeStopped = (ctns: Docker.ContainerInspectInfo[]) =>
const isSomeExited = (ctns: Docker.ContainerInspectInfo[]) =>
ctns.some((ctn) => !ctn.State.Running);
// Wait until containers are in a ready state prior to testing assertions
@ -296,11 +296,11 @@ describe('manages application lifecycle', () => {
.post('/v1/apps/1/stop')
.set('Content-Type', 'application/json');
const stoppedContainers = await waitForSetup(targetState, isAllStopped);
const stoppedContainers = await waitForSetup(targetState, isAllExited);
// Technically the wait function above should already verify that the two
// containers have been restarted, but verify explcitly with an assertion
expect(isAllStopped(stoppedContainers)).to.be.true;
expect(isAllExited(stoppedContainers)).to.be.true;
// Containers should have the same Ids since none should be removed
expect(stoppedContainers.map(({ Id }) => Id)).to.have.members(
@ -577,11 +577,11 @@ describe('manages application lifecycle', () => {
.set('Content-Type', 'application/json')
.send(JSON.stringify({ serviceName: serviceNames[0] }));
const stoppedContainers = await waitForSetup(targetState, isSomeStopped);
const stoppedContainers = await waitForSetup(targetState, isSomeExited);
// Technically the wait function above should already verify that the two
// containers have been restarted, but verify explcitly with an assertion
expect(isSomeStopped(stoppedContainers)).to.be.true;
expect(isSomeExited(stoppedContainers)).to.be.true;
// Containers should have the same Ids since none should be removed
expect(stoppedContainers.map(({ Id }) => Id)).to.have.members(