'``write_request_load_scenario`` should timeout if the outstanding
requests for the scenarion do not complete within the specified
time.'

@capture_logging(None)
def test_scenario_timeouts_if_requests_not_completed(self, _logger):

    c = Clock()
    control_service = self.get_error_response_client_instance(c)
    cluster = self.make_cluster(control_service)
    sample_size = 5
    s = write_request_load_scenario(c, cluster, request_rate=10, sample_size=sample_size)
    control_service.delay = (s.timeout + 10)
    d = s.start()
    s.maintained().addBoth((lambda x: self.fail()))
    c.pump(repeat(1, sample_size))
    control_service.fail_requests = True
    c.advance(1)
    control_service.fail_requests = False
    d.addCallback((lambda ignored: s.stop()))
    self.assertNoResult(d)
    c.advance((s.timeout + 1))
    self.assertTrue((s.rate_measurer.outstanding() > 0))
    self.successResultOf(d)
