better startup and teardown for tests
parent
51d46c2cc0
commit
5bf0ad0367
|
|
@ -632,18 +632,17 @@ class SharedWorkspaceLocking {
|
|||
return element;
|
||||
}
|
||||
}
|
||||
return;
|
||||
yield SharedWorkspaceLocking.CreateLockableWorkspace(cloud_runner_1.default.buildParameters.buildGuid);
|
||||
});
|
||||
}
|
||||
static GetFreeWorkspaces() {
|
||||
return ['test-workspace'];
|
||||
return [];
|
||||
}
|
||||
static GetAllWorkspaces() {
|
||||
return [];
|
||||
}
|
||||
static LockWorkspace(workspace) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// this job + date
|
||||
const file = `${Date.now()}_${cloud_runner_1.default.buildParameters.buildGuid}_lock`;
|
||||
fs.writeFileSync(file, '');
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`aws s3 cp ./${file} s3://game-ci-test-storage/locks/${workspace}/${file}`);
|
||||
|
|
@ -664,8 +663,13 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
static IsWorkspaceLocked(workspace) { }
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
static CreateLockableWorkspace(workspace, locked = false) { }
|
||||
static CreateLockableWorkspace(workspace) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const file = `${Date.now()}_${cloud_runner_1.default.buildParameters.buildGuid}_workspace`;
|
||||
fs.writeFileSync(file, '');
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`aws s3 cp ./${file} s3://game-ci-test-storage/locks/${workspace}/${file}`);
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
static ReleaseLock(workspace) { }
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -16,17 +16,16 @@ export class SharedWorkspaceLocking {
|
|||
}
|
||||
}
|
||||
|
||||
return;
|
||||
await SharedWorkspaceLocking.CreateLockableWorkspace(CloudRunner.buildParameters.buildGuid);
|
||||
}
|
||||
|
||||
public static GetFreeWorkspaces(): string[] {
|
||||
return ['test-workspace'];
|
||||
return [];
|
||||
}
|
||||
public static GetAllWorkspaces(): string[] {
|
||||
return [];
|
||||
}
|
||||
public static async LockWorkspace(workspace: string): Promise<boolean> {
|
||||
// this job + date
|
||||
const file = `${Date.now()}_${CloudRunner.buildParameters.buildGuid}_lock`;
|
||||
fs.writeFileSync(file, '');
|
||||
await CloudRunnerSystem.Run(`aws s3 cp ./${file} s3://game-ci-test-storage/locks/${workspace}/${file}`);
|
||||
|
|
@ -48,8 +47,12 @@ export class SharedWorkspaceLocking {
|
|||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
public static IsWorkspaceLocked(workspace: string) {}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
public static CreateLockableWorkspace(workspace: string, locked: boolean = false) {}
|
||||
|
||||
public static async CreateLockableWorkspace(workspace: string) {
|
||||
const file = `${Date.now()}_${CloudRunner.buildParameters.buildGuid}_workspace`;
|
||||
fs.writeFileSync(file, '');
|
||||
await CloudRunnerSystem.Run(`aws s3 cp ./${file} s3://game-ci-test-storage/locks/${workspace}/${file}`);
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
public static ReleaseLock(workspace: string) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,19 +7,13 @@ import UnityVersioning from '../../unity-versioning';
|
|||
import { Cli } from '../../cli/cli';
|
||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import GitHub from '../../github';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
const originalValue = GitHub.githubInputEnabled;
|
||||
GitHub.githubInputEnabled = false;
|
||||
const results = await BuildParameters.create();
|
||||
GitHub.githubInputEnabled = originalValue;
|
||||
delete Cli.options;
|
||||
|
||||
return results;
|
||||
return await BuildParameters.create();
|
||||
}
|
||||
|
||||
describe('Cloud Runner', () => {
|
||||
|
|
|
|||
|
|
@ -5,19 +5,13 @@ import { Cli } from '../../cli/cli';
|
|||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import GitHub from '../../github';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
if (overrides) {
|
||||
Cli.options = overrides;
|
||||
}
|
||||
const originalValue = GitHub.githubInputEnabled;
|
||||
GitHub.githubInputEnabled = false;
|
||||
const results = await BuildParameters.create();
|
||||
GitHub.githubInputEnabled = originalValue;
|
||||
delete Cli.options;
|
||||
|
||||
return results;
|
||||
return await BuildParameters.create();
|
||||
}
|
||||
|
||||
describe('Cloud Runner Caching', () => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import { Cli } from '../../cli/cli';
|
||||
import GitHub from '../../github';
|
||||
describe('Cloud Runner', () => {
|
||||
it('Responds', () => {});
|
||||
beforeAll(() => {
|
||||
GitHub.githubInputEnabled = false;
|
||||
});
|
||||
afterEach(() => {
|
||||
if (Cli.options === undefined) {
|
||||
delete Cli.options;
|
||||
}
|
||||
});
|
||||
afterAll(() => {
|
||||
GitHub.githubInputEnabled = true;
|
||||
});
|
||||
});
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
import SharedWorkspaceLocking from '../../cli/shared-workspace-locking';
|
||||
import { Cli } from '../../cli/cli';
|
||||
|
||||
describe('Cloud Runner', () => {
|
||||
it('Locking', async () => {
|
||||
Cli.options = {
|
||||
retainWorkspaces: true,
|
||||
};
|
||||
await SharedWorkspaceLocking.IsWorkspaceLocked('test-workspace');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue