mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 05:37:53 +00:00
Remove the 'Stopped' status for services
It's not an official status from container inspects, and the Supervisor doesn't set it internally anywhere. It's better to remove it entirely as the method by which Supervisor sets internal service statuses is by using a global event emitter (reportNewStatus) which makes things difficult to test. Change-type: patch Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
parent
098494d6f4
commit
38fe8dae75
@ -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'
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,6 @@ const unsupportedSecurityOpt = (opt: string) => /label=.*/.test(opt);
|
||||
|
||||
export type ServiceStatus =
|
||||
| 'Stopping'
|
||||
| 'Stopped'
|
||||
| 'Running'
|
||||
| 'Installing'
|
||||
| 'Installed'
|
||||
|
@ -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',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user