IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

test_bootstrap.py 1.5KB

il y a 4 ans
il y a 4 ans
il y a 4 ans
1234567891011121314151617181920212223242526272829303132333435363738
  1. import subprocess
  2. from focker.zfs import *
  3. import re
  4. import os
  5. from focker.bootstrap import command_bootstrap
  6. from focker.misc import focker_unlock
  7. def test_bootstrap_01():
  8. subprocess.check_output(['focker', 'image', 'remove', '--force', 'test-focker-bootstrap'])
  9. subprocess.check_output(['focker', 'bootstrap', '--empty', '--tags', 'test-focker-bootstrap'])
  10. name, sha256 = zfs_find('test-focker-bootstrap', focker_type='image')
  11. basename = os.path.basename(name)
  12. assert 7 <= len(basename) <= 64
  13. assert re.search('[a-f]', basename[:7])
  14. assert len(sha256) == 64
  15. assert basename == sha256[:len(basename)]
  16. assert zfs_exists_snapshot_sha256(sha256)
  17. assert zfs_parse_output(['zfs', 'get', '-H', 'rdonly', name])[0][2] == 'on'
  18. subprocess.check_output(['zfs', 'destroy', '-r', '-f', name])
  19. def test_bootstrap_02():
  20. subprocess.check_output(['focker', 'image', 'remove', '--force', 'test-focker-bootstrap'])
  21. args = lambda: 0
  22. args.empty = True
  23. args.tags = ['test-focker-bootstrap']
  24. command_bootstrap(args)
  25. focker_unlock()
  26. name, sha256 = zfs_find('test-focker-bootstrap', focker_type='image')
  27. basename = os.path.basename(name)
  28. assert 7 <= len(basename) <= 64
  29. assert re.search('[a-f]', basename[:7])
  30. assert len(sha256) == 64
  31. assert basename == sha256[:len(basename)]
  32. assert zfs_exists_snapshot_sha256(sha256)
  33. assert zfs_parse_output(['zfs', 'get', '-H', 'rdonly', name])[0][2] == 'on'
  34. subprocess.check_output(['zfs', 'destroy', '-r', '-f', name])