public void Should_choose_correct_verdict_when_answers_is_empty_depends_on_status(ClusterResultStatus status, ResultReason result)
        {
            var emptyReplicaResults = new List <ReplicaResult>();
            var clusterResult       = new ClusterResult(status, emptyReplicaResults, null, request);

            ClusterResultsAnalyzer.FindResultReason(clusterResult).Should().Be(result);
        }
Exemple #2
0
        public async Task <ClusterResult> ExecuteAsync(IRequestContext context, Func <IRequestContext, Task <ClusterResult> > next)
        {
            var result = await next(context).ConfigureAwait(false);

            metricsProvider.RecordRequest(ClusterResultsAnalyzer.FindResultReason(result));

            return(result);
        }
        public void Should_choose_correct_verdict_for_one_replica_with_exhausted_status_depends_on_code(ResponseCode responseCode, ResultReason result)
        {
            var replicaResults = new List <ReplicaResult>
            {
                CreateRejectReplicaResult(responseCode, cleanHeaders)
            };
            var clusterResult = new ClusterResult(ClusterResultStatus.ReplicasExhausted, replicaResults, null, request);

            ClusterResultsAnalyzer.FindResultReason(clusterResult).Should().Be(result);
        }
        public void Should_choose_correct_verdict_for_throttling_depends_on_header(bool withSingularThrottlingTriggerHeader, ResultReason result)
        {
            var replicaResults = new List <ReplicaResult>
            {
                CreateRejectReplicaResult(
                    ResponseCode.TooManyRequests,
                    withSingularThrottlingTriggerHeader ? xSingularThrottlingTriggerHeaders : cleanHeaders
                    )
            };

            var clusterResult = new ClusterResult(ClusterResultStatus.ReplicasExhausted, replicaResults, null, request);

            ClusterResultsAnalyzer.FindResultReason(clusterResult).Should().Be(result);
        }