FaultPlan class final
A queue of fault rules, matched in order (Design note 4).
REST rules wait for the next request of their operation and apply times times; gateway
faults act at once (or after after). Nothing is random, so a test sees the same faults
on every run.
Example:
server.faults
..onRequest('createMessage', status: 503, code: 'unavailable',
retryAfter: const Duration(milliseconds: 20))
..dropResponseAfterCommit('createMessage');
server.faults.closeGateway(4000);
Constructors
- FaultPlan(GatewayFaultTarget _gateway)
- Creates the plan acting on the gateway of the fake server.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
pending
→ List<
RequestFault> -
The REST rules that have not been used up, in order.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelTimers(
) → void - Cancels the gateway faults that wait for their delay.
-
closeGateway(
int code, {String? reason, Duration? after}) → void -
Closes every gateway connection with
codeandreason, now oraftera delay. -
delay(
Duration duration, {String? operationId, int times = 1}) → void -
Holds the responses of the next
timesrequests ofoperationId(of any operation when null) fordurationafter they were handled. -
dropResponseAfterCommit(
String operationId, {int times = 1}) → void -
Stores the next
timeswrites ofoperationIdand closes their connection before the response (a lost response after the commit, 04 16.2). -
duplicateNextDispatch(
) → void -
Delivers the next
dispatchtwice (at-least-once delivery, 04 9). -
holdDispatches(
) → void -
Holds every
dispatchuntil releaseDispatches. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onRequest(
String operationId, {required int status, required String code, String? reason, Duration? retryAfter, int times = 1}) → void -
Answers the next
timesrequests ofoperationIdwithstatusand a problem withcodeandreason(409,410,412,429,5xx), withRetry-AfterwhenretryAfteris set. -
releaseDispatches(
) → void -
Sends the held
dispatchframes and delivers again. -
resyncRequired(
String reason) → void -
Answers the next session start with a cursor with
resync_requiredandreason(epoch_changed,retention,too_far_behind,cursor_ahead, 04 7.3). -
revoke(
{String? deviceId}) → void -
Closes every connection of
deviceId(every device when null) with4012and marks their sessions revoked (04 8.5). -
take(
String operationId) → RequestFault? -
The fault for the next request of
operationId, used up by one; null when no rule matches. The fake server calls this once per request. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited