open-nomad/ui/mirage/factories/service.js
Drew Bailey befcd11579
add on update to services table in allocation details (#10153)
* add on update to services table in allocation details

* populate onupdate test data
2021-03-11 12:28:38 -05:00

34 lines
876 B
JavaScript

import { Factory } from 'ember-cli-mirage';
import faker from 'nomad-ui/mirage/faker';
import { provide } from '../utils';
const ON_UPDATE = ['default', 'ignore', 'ignore_warnings'];
export default Factory.extend({
name: id => `${faker.hacker.noun().dasherize()}-${id}-service`,
portLabel: () => faker.hacker.noun().dasherize(),
onUpdate: faker.helpers.randomize(ON_UPDATE),
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 }),
},
],
},
},
},
});