'Only 5 logfiles are kept.'

def test_file_logging_rotation_5_files(self):

    logfile = FilePath(self.mktemp()).child('foo.log')
    logfile.parent().makedirs()
    with logfile.open('w') as f:
        f.write('0')
        f.truncate(int(MiB(100).to_Byte().value))
    for i in range(1, 5):
        sibling = logfile.sibling(((logfile.basename() + u'.') + unicode(i)))
        with sibling.open('w') as f:
            f.write(bytes(i))
    d = self.run_script(EliotScript, options=['--logfile', logfile.path])
    def verify_logfiles(stdout_messages, logfile):
        logfile_dir = logfile.parent()
        self.assertEqual(map(bytes, range(0, 4)), list((logfile_dir.child('foo.log.{}'.format(i)).open().read(1) for i in range(1, 5))))
    d.addCallback(verify_logfiles, logfile=logfile)
    return d
