balena-supervisor/test/unit/compose/utils.spec.ts
Christina W 71d24d6e33 Parse container exit error message instead of status
The previous implementation in #2170 of parsing the container status was too general,
because it relied on the mistaken assumption that a container would have a status of
`Stopped` if it was manually stopped. This turned out to be untrue, as manually stopped
containers were also getting restarted by the Supervisor due to their inspect status of
`exited`. With this, parsing the exit message became unavoidable as there are no other
clear ways to discern a container that has been manually stopped and shouldn't be started
from a container experiencing the Engine-host race condition issue (again, see #2170).

Since we're just parsing the exit error message, we don't need to worry about different behaviors
amongst restart policies, as any container with the error message on exit should be started.

Change-type: patch
Closes: #2178
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-06-22 14:43:17 -07:00

15 lines
347 B
TypeScript

import { expect } from 'chai';
import * as ComposeUtils from '~/src/compose/utils';
describe('compose/utils', () => {
it('should correctly camel case the configuration', () => {
const config = {
networks: ['test', 'test2'],
};
expect(ComposeUtils.camelCaseConfig(config)).to.deep.equal({
networks: ['test', 'test2'],
});
});
});