Ping on revival

edit

When a node is marked dead it will only be put in the dog house for a certain amount of time. Once it comes out of the dog house, or revived, a ping is scheduled before an actual API call, to ensure that it’s up and running. If it’s still down, it’s put back in the dog house a little longer.

Take a look at the Request timeouts for an explanation on what each timeout is.

var audit = new Auditor(() => VirtualClusterWith
    .Nodes(3)
    .ClientCalls(r => r.SucceedAlways())
    .ClientCalls(r => r.OnPort(9202).Fails(Once))
    .Ping(p => p.SucceedAlways())
    .StaticConnectionPool()
    .AllDefaults()
);

audit = await audit.TraceCalls(
    new ClientCall { { PingSuccess, 9200 }, { HealthyResponse, 9200 } },
    new ClientCall { { PingSuccess, 9201 }, { HealthyResponse, 9201 } },
    new ClientCall {
        { PingSuccess, 9202},
        { BadResponse, 9202},
        { HealthyResponse, 9200},
        { pool =>  pool.Nodes.Where(n=>!n.IsAlive).Should().HaveCount(1) }
    },
    new ClientCall { { HealthyResponse, 9201 } },
    new ClientCall { { HealthyResponse, 9200 } },
    new ClientCall { { HealthyResponse, 9201 } },
    new ClientCall {
        { HealthyResponse, 9200 },
        { pool => pool.Nodes.First(n=>!n.IsAlive).DeadUntil.Should().BeAfter(DateTime.UtcNow) }
    }
);

audit = await audit.TraceCalls(
    new ClientCall { { HealthyResponse, 9201 } },
    new ClientCall { { HealthyResponse, 9200 } },
    new ClientCall { { HealthyResponse, 9201 } }
);

audit.ChangeTime(d => d.AddMinutes(20));

audit = await audit.TraceCalls(
    new ClientCall { { HealthyResponse, 9201 } },
    new ClientCall {
        { Resurrection, 9202 },
        { PingSuccess, 9202 },
        { HealthyResponse, 9202 }
    }
);