2019-09-26 18:47:07 +00:00
|
|
|
import { Factory } from 'ember-cli-mirage';
|
2019-10-03 14:13:08 +00:00
|
|
|
import faker from 'nomad-ui/mirage/faker';
|
2017-09-19 14:47:10 +00:00
|
|
|
import { generateResources } from '../common';
|
|
|
|
|
2018-05-12 00:30:15 +00:00
|
|
|
const DRIVERS = ['docker', 'java', 'rkt', 'qemu', 'exec', 'raw_exec'];
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
export default Factory.extend({
|
|
|
|
// Hidden property used to compute the Summary hash
|
|
|
|
groupNames: [],
|
|
|
|
|
2020-02-12 19:49:28 +00:00
|
|
|
// Set in the TaskGroup factory
|
|
|
|
volumeMounts: [],
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
JobID: '',
|
|
|
|
|
2018-06-13 22:04:31 +00:00
|
|
|
name: id => `task-${faker.hacker.noun().dasherize()}-${id}`,
|
2019-09-30 14:44:22 +00:00
|
|
|
driver: () => faker.helpers.randomize(DRIVERS),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
Resources: generateResources,
|
2020-04-30 13:15:19 +00:00
|
|
|
|
|
|
|
Lifecycle: i => {
|
|
|
|
const cycle = i % 3;
|
|
|
|
|
|
|
|
if (cycle === 0) {
|
|
|
|
return null;
|
|
|
|
} else if (cycle === 1) {
|
|
|
|
return { Hook: 'prestart', Sidecar: false };
|
|
|
|
} else {
|
|
|
|
return { Hook: 'prestart', Sidecar: true };
|
|
|
|
}
|
|
|
|
},
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|