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!
Pārlūkot izejas kodu

Add test for build_images.

master
Stanislaw Adaszewski pirms 4 gadiem
vecāks
revīzija
4807809916
1 mainītis faili ar 25 papildinājumiem un 1 dzēšanām
  1. +25
    -1
      tests/test_compose.py

+ 25
- 1
tests/test_compose.py Parādīt failu

@@ -1,7 +1,8 @@
from focker.compose import exec_hook, \
exec_prebuild, \
exec_postbuild, \
build_volumes
build_volumes, \
build_images
from tempfile import TemporaryDirectory
import os
import pytest
@@ -15,6 +16,7 @@ from focker.zfs import zfs_find, \
zfs_mountpoint, \
zfs_parse_output
import subprocess
import yaml
def test_exec_hook_01():
@@ -129,3 +131,25 @@ def test_build_volumes():
assert zst[0][2] == '1G'
assert zst[1][2] == 'on'
subprocess.check_output(['zfs', 'destroy', '-r', '-f', name])
def test_build_images():
# focker_unlock()
subprocess.check_output(['focker', 'image', 'remove', '--force', 'test-build-images'])
with TemporaryDirectory() as d:
with open(os.path.join(d, 'Fockerfile'), 'w') as f:
yaml.dump({
'base': 'freebsd-latest',
'steps': [
{ 'run': 'touch /test-build-images' }
]
}, f)
args = lambda: 0
args.squeeze = False
build_images({
'test-build-images': '.'
}, d, args)
focker_unlock()
name, _ = zfs_find('test-build-images', focker_type='image')
assert os.path.exists(os.path.join(zfs_mountpoint(name), 'test-build-images'))
subprocess.check_output(['focker', 'image', 'remove', '--force', 'test-build-images'])

Notiek ielāde…
Atcelt
Saglabāt