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 // check that we want to stop it, and that it isn't stopped
return ( return (
serviceTarget.config.running === false && 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 = export type ServiceStatus =
| 'Stopping' | 'Stopping'
| 'Stopped'
| 'Running' | 'Running'
| 'Installing' | 'Installing'
| 'Installed' | 'Installed'

View File

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

View File

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