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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

39 lines
1.5KB

  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])