0dd9ffdab3
This is meant to address the plugin test failure seen here: https://app.circleci.com/pipelines/github/hashicorp/nomad/10015/workflows/ace5d615-db03-4cfc-86b2-31e9e00473ec/jobs/77014/tests I believe the problem was that on rare occasions, the set of mock storage controllers and nodes were all unhealthy, so the facet test had no rows to iterate through. Since there are always three of each, this guarantees some healthy ones will be present.
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
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: i => [true, false][i % 2],
|
|
healthDescription() {
|
|
this.healthy ? 'healthy' : 'unhealthy';
|
|
},
|
|
|
|
updateTime: () => faker.date.past(2 / 365, REF_TIME),
|
|
|
|
requiresControllerPlugin: true,
|
|
requiresTopologies: true,
|
|
|
|
shallow: false,
|
|
|
|
controllerInfo: () => ({
|
|
SupportsReadOnlyAttach: true,
|
|
SupportsAttachDetach: true,
|
|
SupportsListVolumes: true,
|
|
SupportsListVolumesAttachedNodes: false,
|
|
}),
|
|
|
|
afterCreate(storageController, server) {
|
|
const alloc = server.create('allocation', {
|
|
jobId: storageController.job.id,
|
|
forceRunningClientStatus: true,
|
|
modifyTime: storageController.updateTime * 1000000,
|
|
shallow: storageController.shallow,
|
|
});
|
|
|
|
storageController.update({
|
|
allocID: alloc.id,
|
|
nodeId: alloc.nodeId,
|
|
});
|
|
},
|
|
});
|