extract lib in caching flow
parent
b7c8c34f0d
commit
7ad6ffd3f7
|
@ -40,7 +40,8 @@ describe('Cloud Runner Locking', () => {
|
||||||
const isExpectedUnlockedBeforeLocking =
|
const isExpectedUnlockedBeforeLocking =
|
||||||
(await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === false;
|
(await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === false;
|
||||||
expect(isExpectedUnlockedBeforeLocking).toBeTruthy();
|
expect(isExpectedUnlockedBeforeLocking).toBeTruthy();
|
||||||
await SharedWorkspaceLocking.LockWorkspace(newWorkspaceName, runId, buildParameters);
|
const result = await SharedWorkspaceLocking.LockWorkspace(newWorkspaceName, runId, buildParameters);
|
||||||
|
expect(result).toBeTruthy();
|
||||||
const lines = await SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}`);
|
const lines = await SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}`);
|
||||||
expect(lines.map((x) => x.replace(`/`, ``)).includes(buildParameters.cacheKey));
|
expect(lines.map((x) => x.replace(`/`, ``)).includes(buildParameters.cacheKey));
|
||||||
expect(await SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParameters)).toBeTruthy();
|
expect(await SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParameters)).toBeTruthy();
|
||||||
|
@ -51,15 +52,15 @@ describe('Cloud Runner Locking', () => {
|
||||||
await SharedWorkspaceLocking.ReadLines(
|
await SharedWorkspaceLocking.ReadLines(
|
||||||
`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParameters.cacheKey}/`,
|
`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParameters.cacheKey}/`,
|
||||||
)
|
)
|
||||||
).filter((x) => x.includes(`${newWorkspaceName}_workspace_lock`)).length,
|
).filter((x) => x.includes(`${newWorkspaceName}_workspace_lock`)),
|
||||||
).toBeGreaterThan(0);
|
).toHaveLength(1);
|
||||||
expect(
|
expect(
|
||||||
(
|
(
|
||||||
await SharedWorkspaceLocking.ReadLines(
|
await SharedWorkspaceLocking.ReadLines(
|
||||||
`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParameters.cacheKey}/`,
|
`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParameters.cacheKey}/`,
|
||||||
)
|
)
|
||||||
).filter((x) => x.includes(`${newWorkspaceName}_workspace`)).length,
|
).filter((x) => x.includes(`${newWorkspaceName}_workspace`)),
|
||||||
).toBeGreaterThan(0);
|
).toHaveLength(1);
|
||||||
expect(allLocks.filter((x) => x.includes(`${newWorkspaceName}_workspace_lock`)).length).toBeGreaterThan(0);
|
expect(allLocks.filter((x) => x.includes(`${newWorkspaceName}_workspace_lock`)).length).toBeGreaterThan(0);
|
||||||
const isExpectedLockedAfterLocking =
|
const isExpectedLockedAfterLocking =
|
||||||
(await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === true;
|
(await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === true;
|
||||||
|
|
Loading…
Reference in New Issue