locking 2nd time
parent
0bc0c4d8fb
commit
de525aef53
|
@ -5712,7 +5712,7 @@ class SharedWorkspaceLocking {
|
|||
static GetOrCreateLockedWorkspace(workspace, runId, buildParametersContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!cloud_runner_options_1.default.retainWorkspaces) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (yield SharedWorkspaceLocking.DoesCacheKeyTopLevelExist(buildParametersContext)) {
|
||||
|
@ -5730,7 +5730,7 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
}
|
||||
catch (_a) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
const createResult = yield SharedWorkspaceLocking.CreateWorkspace(workspace, buildParametersContext, runId);
|
||||
cloud_runner_logger_1.default.log(`run agent ${runId} didn't find a free workspace so created: ${workspace} createWorkspaceSuccess: ${createResult}`);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -48,7 +48,7 @@ export class SharedWorkspaceLocking {
|
|||
buildParametersContext: BuildParameters,
|
||||
) {
|
||||
if (!CloudRunnerOptions.retainWorkspaces) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -70,7 +70,7 @@ export class SharedWorkspaceLocking {
|
|||
}
|
||||
}
|
||||
} catch {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const createResult = await SharedWorkspaceLocking.CreateWorkspace(workspace, buildParametersContext, runId);
|
||||
|
|
|
@ -76,9 +76,15 @@ describe('Cloud Runner Locking', () => {
|
|||
expect(isExpectedNotLockedAfterReleasing).toBeTruthy();
|
||||
const lockingResult2 = await SharedWorkspaceLocking.LockWorkspace(newWorkspaceName, runId, buildParameters);
|
||||
expect(lockingResult2).toBeTruthy();
|
||||
const isExpectedLockedAgainAfterReleasing =
|
||||
(await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === false;
|
||||
expect(isExpectedLockedAgainAfterReleasing).toBeTruthy();
|
||||
expect((await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === true).toBeTruthy();
|
||||
await SharedWorkspaceLocking.ReleaseWorkspace(newWorkspaceName, runId, buildParameters);
|
||||
expect(
|
||||
(await SharedWorkspaceLocking.IsWorkspaceLocked(newWorkspaceName, buildParameters)) === false,
|
||||
).toBeTruthy();
|
||||
await SharedWorkspaceLocking.CleanupWorkspace(newWorkspaceName, buildParameters);
|
||||
expect(
|
||||
await SharedWorkspaceLocking.GetOrCreateLockedWorkspace(newWorkspaceName, runId, buildParameters),
|
||||
).toBeTruthy();
|
||||
}, 150000);
|
||||
it.skip('All Locking Actions', async () => {
|
||||
Cli.options.retainWorkspaces = true;
|
||||
|
|
Loading…
Reference in New Issue