def then_backup_files_successfully_rotated(step): command = ["rm", "-f", "%s/*" % BACKUP_DIR] sysutils.send_command(command) command = ["touch", "%s/data.tgz" % BACKUP_DIR] sysutils.send_command(command) command = ["touch", "%s/db.tgz" % BACKUP_DIR] sysutils.send_command(command) command = ["/usr/sbin/logrotate", "-f", "/etc/logrotate.d/xivo-backup"] sysutils.send_command(command) expected_files = ["data.tgz", "data.tgz.1", "db.tgz", "db.tgz.1"] for expected_file in expected_files: assert sysutils.path_exists("%s/%s" % (BACKUP_DIR, expected_file)) command = ["/usr/sbin/logrotate", "-f", "/etc/logrotate.d/xivo-backup"] sysutils.send_command(command) expected_files.extend(["data.tgz.2", "db.tgz.2"]) for expected_file in expected_files: assert sysutils.path_exists("%s/%s" % (BACKUP_DIR, expected_file))
def then_backup_files_successfully_rotated(step): command = ['rm', '-f', '%s/*' % BACKUP_DIR] sysutils.send_command(command) command = ['touch', '%s/data.tgz' % BACKUP_DIR] sysutils.send_command(command) command = ['touch', '%s/db.tgz' % BACKUP_DIR] sysutils.send_command(command) command = ['/usr/sbin/logrotate', '-f', '/etc/logrotate.d/xivo-backup'] sysutils.send_command(command) expected_files = ['data.tgz', 'data.tgz.1', 'db.tgz', 'db.tgz.1'] for expected_file in expected_files: assert sysutils.path_exists('%s/%s' % (BACKUP_DIR, expected_file)) command = ['/usr/sbin/logrotate', '-f', '/etc/logrotate.d/xivo-backup'] sysutils.send_command(command) expected_files.extend(['data.tgz.2', 'db.tgz.2']) for expected_file in expected_files: assert sysutils.path_exists('%s/%s' % (BACKUP_DIR, expected_file))
def then_there_should_be_a_file_name_group1(step, filename_pattern): filename = _replace_variables(filename_pattern) path = '~/%s' % filename assert sysutils.path_exists(path), 'No such file or directory %s' % path