2020-03-25 12:51:26 +00:00
|
|
|
import { Factory } from 'ember-cli-mirage';
|
|
|
|
import faker from 'nomad-ui/mirage/faker';
|
|
|
|
import { STORAGE_PROVIDERS } from '../common';
|
|
|
|
const REF_TIME = new Date();
|
|
|
|
|
|
|
|
export default Factory.extend({
|
|
|
|
provider: faker.helpers.randomize(STORAGE_PROVIDERS),
|
|
|
|
providerVersion: '1.0.1',
|
|
|
|
|
|
|
|
healthy: faker.random.boolean,
|
|
|
|
healthDescription() {
|
|
|
|
this.healthy ? 'healthy' : 'unhealthy';
|
|
|
|
},
|
|
|
|
|
2020-05-05 04:35:58 +00:00
|
|
|
updateTime: () => faker.date.past(2 / 365, REF_TIME),
|
2020-03-25 12:51:26 +00:00
|
|
|
|
|
|
|
requiresControllerPlugin: true,
|
|
|
|
requiresTopologies: true,
|
|
|
|
|
|
|
|
controllerInfo: () => ({
|
|
|
|
SupportsReadOnlyAttach: true,
|
|
|
|
SupportsAttachDetach: true,
|
|
|
|
SupportsListVolumes: true,
|
|
|
|
SupportsListVolumesAttachedNodes: false,
|
|
|
|
}),
|
|
|
|
|
|
|
|
afterCreate(storageController, server) {
|
|
|
|
const alloc = server.create('allocation', {
|
|
|
|
jobId: storageController.job.id,
|
2020-05-04 19:20:16 +00:00
|
|
|
forceRunningClientStatus: true,
|
2020-05-05 04:35:58 +00:00
|
|
|
modifyTime: storageController.updateTime * 1000000,
|
2020-03-25 12:51:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
storageController.update({
|
2020-05-04 19:20:16 +00:00
|
|
|
allocID: alloc.id,
|
2020-03-25 12:51:26 +00:00
|
|
|
nodeId: alloc.nodeId,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|