Implement takeLock composition step + tests

This commit only implements the action that a takeLock step
results in. It does not add takeLock step generation logic
to the state funnel yet.

Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
Christina Ying Wang
2024-02-13 21:53:05 -08:00
parent f2843e1382
commit e6df78a22b
3 changed files with 176 additions and 3 deletions

View File

@ -97,6 +97,7 @@ interface CompositionStepArgs {
noop: object;
takeLock: {
appId: number;
services: string[];
};
releaseLock: {
appId: number;
@ -283,8 +284,8 @@ export function getExecutors(app: {
noop: async () => {
/* async noop */
},
takeLock: async () => {
// TODO
takeLock: async (step) => {
await updateLock.takeLock(step.appId, step.services);
},
releaseLock: async (step) => {
await updateLock.releaseLock(step.appId);