def test_resize_no_size(): backupctl.resize( ohistory(), customer='customer1', vault=None, size=None, )
def test_customer(mock_zfs, ohistory, odirvish): backupctl.new( ohistory, odirvish, pool="backup", root=os.path.join(os.sep, "tmp", "backupctl", "backup"), customer="customer1", size="1G", client=None, ) backupctl.resize(ohistory, pool="backup", customer="customer1", size="2G") backupctl.remove(ohistory, pool="backup", customer="customer1") assert mock_zfs == [ [ "zfs", "create", "-o", "compression=on", "-o", "dedup=off", "-o", "quota=1G", "-o", "mountpoint={0}".format( os.path.join(os.sep, "tmp", "backupctl", "backup", "customer1")), "backup/customer1", ], ["zfs", "get", "-H", "-o", "value", "-p", "used", "backup/customer1"], ["zfs", "set", "quota=2G", "backup/customer1"], ["zfs", "set", "mountpoint=none", "backup/customer1"], ["zfs", "destroy", "-r", "-f", "backup/customer1"], ]
def test_resize_no_size(ohistory): backupctl.resize(ohistory, customer="customer1", vault=None, size=None)
def test_vault(mock_zfs): backupctl.new( ohistory(), odirvish(), pool='backup', root=os.path.join(os.sep, 'tmp', 'backupctl', 'backup'), customer='customer1', size='1G', client=None, ) backupctl.new( ohistory(), odirvish(), pool='backup', root=os.path.join(os.sep, 'tmp', 'backupctl', 'backup'), customer='customer1', vault='www.example.com', size='500M', client=None, ) backupctl.new( ohistory(), odirvish(), pool='backup', root=os.path.join(os.sep, 'tmp', 'backupctl', 'backup'), customer='customer1', vault='mail.example.com', size='500M', client='192.0.2.1', ) backupctl.resize( ohistory(), pool='backup', customer='customer1', vault='mail.example.com', size='200M', ) backupctl.remove( ohistory(), pool='backup', customer='customer1', vault='mail.example.com', ) backupctl.remove( ohistory(), pool='backup', customer='customer1', ) assert mock_zfs == [ [ 'zfs', 'create', '-o', 'compression=on', '-o', 'dedup=off', '-o', 'quota=1G', '-o', 'mountpoint={0}'.format(os.path.join( os.sep, 'tmp', 'backupctl', 'backup', 'customer1', )), 'backup/customer1', ], [ 'zfs', 'create', '-o', 'compression=on', '-o', 'dedup=off', '-o', 'quota=500M', '-o', 'mountpoint={0}'.format(os.path.join( os.sep, 'tmp', 'backupctl', 'backup', 'customer1', 'www.example.com', )), 'backup/customer1/www.example.com', ], [ 'zfs', 'create', '-o', 'compression=on', '-o', 'dedup=off', '-o', 'quota=500M', '-o', 'mountpoint={0}'.format(os.path.join( os.sep, 'tmp', 'backupctl', 'backup', 'customer1', 'mail.example.com', )), 'backup/customer1/mail.example.com', ], [ 'zfs', 'get', '-H', '-o', 'value', '-p', 'used', 'backup/customer1/mail.example.com', ], [ 'zfs', 'set', 'quota=200M', 'backup/customer1/mail.example.com', ], [ 'zfs', 'set', 'mountpoint=none', 'backup/customer1/mail.example.com', ], [ 'zfs', 'destroy', '-r', '-f', 'backup/customer1/mail.example.com', ], [ 'zfs', 'set', 'mountpoint=none', 'backup/customer1', ], [ 'zfs', 'destroy', '-r', '-f', 'backup/customer1', ], ]