better startup and teardown for tests
parent
5bf0ad0367
commit
a330d4e9a3
|
|
@ -632,7 +632,7 @@ class SharedWorkspaceLocking {
|
|||
return element;
|
||||
}
|
||||
}
|
||||
yield SharedWorkspaceLocking.CreateLockableWorkspace(cloud_runner_1.default.buildParameters.buildGuid);
|
||||
return yield SharedWorkspaceLocking.CreateLockableWorkspace(cloud_runner_1.default.buildParameters.buildGuid);
|
||||
});
|
||||
}
|
||||
static GetFreeWorkspaces() {
|
||||
|
|
@ -668,6 +668,7 @@ class SharedWorkspaceLocking {
|
|||
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}`);
|
||||
return cloud_runner_1.default.buildParameters.buildGuid;
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,7 @@ export class SharedWorkspaceLocking {
|
|||
}
|
||||
}
|
||||
|
||||
await SharedWorkspaceLocking.CreateLockableWorkspace(CloudRunner.buildParameters.buildGuid);
|
||||
return await SharedWorkspaceLocking.CreateLockableWorkspace(CloudRunner.buildParameters.buildGuid);
|
||||
}
|
||||
|
||||
public static GetFreeWorkspaces(): string[] {
|
||||
|
|
@ -52,6 +52,8 @@ export class SharedWorkspaceLocking {
|
|||
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}`);
|
||||
|
||||
return CloudRunner.buildParameters.buildGuid;
|
||||
}
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
public static ReleaseLock(workspace: string) {}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import UnityVersioning from '../../unity-versioning';
|
|||
import { Cli } from '../../cli/cli';
|
||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import setups from './cloud-runner-suite.test';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
if (overrides) {
|
||||
|
|
@ -15,14 +16,11 @@ async function CreateParameters(overrides) {
|
|||
|
||||
return await BuildParameters.create();
|
||||
}
|
||||
|
||||
describe('Cloud Runner', () => {
|
||||
it('Responds', () => {});
|
||||
});
|
||||
describe('Cloud Runner', () => {
|
||||
setups();
|
||||
const testSecretName = 'testSecretName';
|
||||
const testSecretValue = 'testSecretValue';
|
||||
it('Responds', () => {});
|
||||
if (CloudRunnerOptions.cloudRunnerTests) {
|
||||
it('All build parameters sent to cloud runner as env vars', async () => {
|
||||
// Setup parameters
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ 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 setups from './cloud-runner-suite.test';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
if (overrides) {
|
||||
|
|
@ -14,10 +15,9 @@ async function CreateParameters(overrides) {
|
|||
return await BuildParameters.create();
|
||||
}
|
||||
|
||||
describe('Cloud Runner Caching', () => {
|
||||
describe('Cloud Runner', () => {
|
||||
it('Responds', () => {});
|
||||
});
|
||||
describe('Cloud Runner Caching', () => {
|
||||
setups();
|
||||
if (CloudRunnerOptions.cloudRunnerTests) {
|
||||
it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
|
||||
const overrides = {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { Cli } from '../../cli/cli';
|
|||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import GitHub from '../../github';
|
||||
import setups from './cloud-runner-suite.test';
|
||||
|
||||
async function CreateParameters(overrides) {
|
||||
if (overrides) {
|
||||
|
|
@ -22,6 +23,7 @@ async function CreateParameters(overrides) {
|
|||
return results;
|
||||
}
|
||||
describe('Cloud Runner', () => {
|
||||
setups();
|
||||
const testSecretName = 'testSecretName';
|
||||
const testSecretValue = 'testSecretValue';
|
||||
it('Responds', () => {});
|
||||
|
|
|
|||
|
|
@ -1,16 +1,25 @@
|
|||
import { Cli } from '../../cli/cli';
|
||||
import GitHub from '../../github';
|
||||
|
||||
describe('Cloud Runner', () => {
|
||||
it('Responds', () => {});
|
||||
});
|
||||
|
||||
const setups = () => {
|
||||
beforeAll(() => {
|
||||
GitHub.githubInputEnabled = false;
|
||||
});
|
||||
beforeEach(() => {
|
||||
Cli.options = {};
|
||||
});
|
||||
afterEach(() => {
|
||||
if (Cli.options === undefined) {
|
||||
if (Cli.options !== undefined) {
|
||||
delete Cli.options;
|
||||
}
|
||||
});
|
||||
afterAll(() => {
|
||||
GitHub.githubInputEnabled = true;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export default setups;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import SharedWorkspaceLocking from '../../cli/shared-workspace-locking';
|
||||
import { Cli } from '../../cli/cli';
|
||||
import setups from './cloud-runner-suite.test';
|
||||
|
||||
describe('Cloud Runner', () => {
|
||||
setups();
|
||||
it('Locking', async () => {
|
||||
Cli.options = {
|
||||
retainWorkspaces: true,
|
||||
};
|
||||
Cli.options.retainWorkspaces = true;
|
||||
await SharedWorkspaceLocking.IsWorkspaceLocked('test-workspace');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue