-- -- macavity: input validation. Every case here must fail, and none of them -- may leave an event in the registry. -- -- unknown fault point SELECT macavity_arm('wal_insert', 'error'); ERROR: macavity: unrecognized fault point "wal_insert" HINT: Supported fault points are: executor_start, executor_end, before_commit, before_abort. See macavity_points(). SELECT macavity_arm('', 'error'); ERROR: macavity: unrecognized fault point "" HINT: Supported fault points are: executor_start, executor_end, before_commit, before_abort. See macavity_points(). SELECT macavity_arm('EXECUTOR_START', 'error'); ERROR: macavity: unrecognized fault point "EXECUTOR_START" HINT: Supported fault points are: executor_start, executor_end, before_commit, before_abort. See macavity_points(). SELECT macavity_arm_error('wal_insert'); ERROR: macavity: unrecognized fault point "wal_insert" HINT: Supported fault points are: executor_start, executor_end, before_commit, before_abort. See macavity_points(). SELECT macavity_arm_delay(''); ERROR: macavity: unrecognized fault point "" HINT: Supported fault points are: executor_start, executor_end, before_commit, before_abort. See macavity_points(). -- unknown action SELECT macavity_arm('executor_start', 'panic'); ERROR: macavity: unrecognized action "panic" HINT: Supported actions are: error, crash, delay. SELECT macavity_arm('executor_start', 'ERROR'); ERROR: macavity: unrecognized action "ERROR" HINT: Supported actions are: error, crash, delay. -- occurrence must be positive SELECT macavity_arm('executor_start', 'error', 0); ERROR: macavity: occurrence must be greater than zero, got 0 SELECT macavity_arm('executor_start', 'error', -1); ERROR: macavity: occurrence must be greater than zero, got -1 SELECT macavity_arm_delay('executor_start', 0); ERROR: macavity: occurrence must be greater than zero, got 0 SELECT macavity_arm_crash('executor_start', -1); ERROR: macavity: occurrence must be greater than zero, got -1 -- nulls are reported, not silently ignored SELECT macavity_arm(NULL, 'error'); ERROR: macavity: point, action and occurrence must not be null SELECT macavity_arm('executor_start', NULL); ERROR: macavity: point, action and occurrence must not be null SELECT macavity_arm('executor_start', 'error', NULL); ERROR: macavity: point, action and occurrence must not be null SELECT macavity_arm_error(NULL); ERROR: macavity: point and occurrence must not be null SELECT macavity_arm_delay('executor_start', NULL); ERROR: macavity: point and occurrence must not be null SELECT macavity_arm(NULL::integer); ERROR: macavity: event_id must not be null -- 'error' cannot be injected into abort processing, by either form SELECT macavity_arm('before_abort', 'error'); ERROR: macavity: action "error" is not supported at fault point "before_abort" DETAIL: PostgreSQL has no pre-abort hook; the abort is already in progress when this point is reached, so raising an error there would escalate to FATAL. HINT: Use action "crash" or "delay" at "before_abort", or arm "error" at "before_commit". SELECT macavity_arm_error('before_abort'); ERROR: macavity: action "error" is not supported at fault point "before_abort" DETAIL: PostgreSQL has no pre-abort hook; the abort is already in progress when this point is reached, so raising an error there would escalate to FATAL. HINT: Use action "crash" or "delay" at "before_abort", or arm "error" at "before_commit". -- reinstating needs an event that exists SELECT macavity_arm(1); ERROR: macavity: event 1 does not exist in this session HINT: See macavity_status() for this session's events. SELECT macavity_arm(0); ERROR: macavity: event 0 does not exist in this session HINT: See macavity_status() for this session's events. SELECT macavity_arm(-1); ERROR: macavity: event -1 does not exist in this session HINT: See macavity_status() for this session's events. -- nothing above may have created anything SELECT * FROM macavity_status(); event_id | point | action | occurrence | hits | remaining | state ----------+-------+--------+------------+------+-----------+------- (0 rows) -- disarming an ID that does not exist is not an error, just a no-op SELECT macavity_disarm(1); macavity_disarm ----------------- f (1 row) SELECT macavity_disarm(-1); macavity_disarm ----------------- f (1 row) -- a failed arm does not consume an event ID: the first real event is 1 SELECT macavity_arm('executor_start', 'error', 400); macavity_arm -------------- 1 (1 row) SELECT macavity_reset(); macavity_reset ---------------- 1 (1 row) -- the point/action lists are still intact after all that SELECT count(*) AS points FROM macavity_points(); points -------- 4 (1 row)