Revision 5cd95d46
b/htest/Test/Ganeti/Types.hs | ||
---|---|---|
132 | 132 |
|
133 | 133 |
$(genArbitrary ''OpStatus) |
134 | 134 |
|
135 |
$(genArbitrary ''ELogType) |
|
136 |
|
|
135 | 137 |
-- * Properties |
136 | 138 |
|
137 | 139 |
prop_AllocPolicy_serialisation :: AllocPolicy -> Property |
... | ... | |
352 | 354 |
prop_OpSubmitPriority_serialisation :: OpSubmitPriority -> Property |
353 | 355 |
prop_OpSubmitPriority_serialisation = testSerialisation |
354 | 356 |
|
357 |
-- | Test 'ELogType' serialisation. |
|
358 |
prop_ELogType_serialisation :: ELogType -> Property |
|
359 |
prop_ELogType_serialisation = testSerialisation |
|
360 |
|
|
355 | 361 |
testSuite "Types" |
356 | 362 |
[ 'prop_AllocPolicy_serialisation |
357 | 363 |
, 'case_AllocPolicy_order |
... | ... | |
394 | 400 |
, 'prop_JobId_serialisation |
395 | 401 |
, 'prop_JobDependency_serialisation |
396 | 402 |
, 'prop_OpSubmitPriority_serialisation |
403 |
, 'prop_ELogType_serialisation |
|
397 | 404 |
] |
b/htools/Ganeti/Types.hs | ||
---|---|---|
89 | 89 |
, OpStatus(..) |
90 | 90 |
, opStatusToRaw |
91 | 91 |
, opStatusFromRaw |
92 |
, ELogType(..) |
|
92 | 93 |
) where |
93 | 94 |
|
94 | 95 |
import Control.Monad (liftM) |
... | ... | |
453 | 454 |
|
454 | 455 |
-- | Our ADT for the OpCode status at runtime (while in a job). |
455 | 456 |
$(THH.declareSADT "OpStatus" |
456 |
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued)
|
|
457 |
, ("OP_STATUS_WAITING", 'C.opStatusWaiting)
|
|
458 |
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
|
|
459 |
, ("OP_STATUS_RUNNING", 'C.opStatusRunning)
|
|
460 |
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled)
|
|
461 |
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess)
|
|
462 |
, ("OP_STATUS_ERROR", 'C.opStatusError)
|
|
463 |
])
|
|
457 |
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued) |
|
458 |
, ("OP_STATUS_WAITING", 'C.opStatusWaiting) |
|
459 |
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling) |
|
460 |
, ("OP_STATUS_RUNNING", 'C.opStatusRunning) |
|
461 |
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled) |
|
462 |
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess) |
|
463 |
, ("OP_STATUS_ERROR", 'C.opStatusError) |
|
464 |
]) |
|
464 | 465 |
$(THH.makeJSONInstance ''OpStatus) |
466 |
|
|
467 |
-- | Type for the job message type. |
|
468 |
$(THH.declareSADT "ELogType" |
|
469 |
[ ("ELogMessage", 'C.elogMessage) |
|
470 |
, ("ELogRemoteImport", 'C.elogRemoteImport) |
|
471 |
, ("ELogJqueueTest", 'C.elogJqueueTest) |
|
472 |
]) |
|
473 |
$(THH.makeJSONInstance ''ELogType) |
Also available in: Unified diff