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';
|
2019-09-04 14:39:56 +00:00
|
|
|
import { provide } from '../utils';
|
|
|
|
|
2021-03-11 17:28:38 +00:00
|
|
|
const ON_UPDATE = ['default', 'ignore', 'ignore_warnings'];
|
|
|
|
|
2019-09-04 14:39:56 +00:00
|
|
|
export default Factory.extend({
|
|
|
|
name: id => `${faker.hacker.noun().dasherize()}-${id}-service`,
|
|
|
|
portLabel: () => faker.hacker.noun().dasherize(),
|
2021-03-11 17:28:38 +00:00
|
|
|
onUpdate: faker.helpers.randomize(ON_UPDATE),
|
2019-09-04 14:39:56 +00:00
|
|
|
tags: () => {
|
|
|
|
if (!faker.random.boolean()) {
|
|
|
|
return provide(
|
|
|
|
faker.random.number({ min: 0, max: 2 }),
|
|
|
|
faker.hacker.noun.bind(faker.hacker.noun)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Connect: {
|
|
|
|
SidecarService: {
|
|
|
|
Proxy: {
|
|
|
|
Upstreams: [
|
|
|
|
{
|
|
|
|
DestinationName: faker.hacker.noun().dasherize(),
|
|
|
|
LocalBindPort: faker.random.number({ min: 5000, max: 60000 }),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|