2015-12-03 13:19:15 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2016-05-25 11:39:02 +00:00
|
|
|
try:
|
|
|
|
import unittest2 as unittest
|
|
|
|
except ImportError:
|
|
|
|
import unittest
|
2015-12-03 13:19:15 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2019-10-04 12:45:03 +00:00
|
|
|
import six
|
|
|
|
|
2015-12-03 13:19:15 +00:00
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
|
|
|
|
|
|
from pungi.wrappers.lorax import LoraxWrapper
|
|
|
|
|
|
|
|
|
|
|
|
class LoraxWrapperTest(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.lorax = LoraxWrapper()
|
|
|
|
|
|
|
|
def test_get_command_with_minimal_arguments(self):
|
|
|
|
cmd = self.lorax.get_lorax_cmd("product", "version", "release",
|
|
|
|
"/mnt/repo_baseurl", "/mnt/output_dir")
|
|
|
|
|
|
|
|
self.assertEqual(cmd[0], 'lorax')
|
2019-10-04 12:45:03 +00:00
|
|
|
six.assertCountEqual(
|
|
|
|
self,
|
|
|
|
cmd[1:],
|
|
|
|
["--product=product",
|
|
|
|
"--version=version",
|
|
|
|
"--release=release",
|
|
|
|
"--source=file:///mnt/repo_baseurl",
|
|
|
|
"/mnt/output_dir"],
|
|
|
|
)
|
2015-12-03 13:19:15 +00:00
|
|
|
|
|
|
|
def test_get_command_with_all_arguments(self):
|
|
|
|
cmd = self.lorax.get_lorax_cmd("product", "version", "release",
|
|
|
|
"/mnt/repo_baseurl", "/mnt/output_dir",
|
|
|
|
variant="Server", bugurl="http://example.com/",
|
|
|
|
nomacboot=True, noupgrade=True, is_final=True,
|
|
|
|
buildarch='x86_64', volid='VOLUME_ID',
|
2016-03-23 09:40:16 +00:00
|
|
|
buildinstallpackages=['bash', 'vim'],
|
|
|
|
add_template=['t1', 't2'],
|
|
|
|
add_arch_template=['ta1', 'ta2'],
|
|
|
|
add_template_var=['v1', 'v2'],
|
2016-11-09 07:50:37 +00:00
|
|
|
add_arch_template_var=['va1', 'va2'],
|
2019-10-09 08:54:48 +00:00
|
|
|
log_dir="/tmp",
|
|
|
|
dracut_args=["--foo", "bar"])
|
2015-12-03 13:19:15 +00:00
|
|
|
|
|
|
|
self.assertEqual(cmd[0], 'lorax')
|
2019-10-04 12:45:03 +00:00
|
|
|
six.assertCountEqual(
|
|
|
|
self,
|
|
|
|
cmd[1:],
|
|
|
|
["--product=product", "--version=version",
|
|
|
|
"--release=release", "--variant=Server",
|
|
|
|
"--source=file:///mnt/repo_baseurl",
|
|
|
|
"--bugurl=http://example.com/",
|
|
|
|
"--buildarch=x86_64", "--volid=VOLUME_ID",
|
|
|
|
"--nomacboot", "--noupgrade", "--isfinal",
|
|
|
|
"--installpkgs=bash", "--installpkgs=vim",
|
|
|
|
"--add-template=t1", "--add-template=t2",
|
|
|
|
"--add-arch-template=ta1", "--add-arch-template=ta2",
|
|
|
|
"--add-template-var=v1", "--add-template-var=v2",
|
|
|
|
"--add-arch-template-var=va1", "--add-arch-template-var=va2",
|
|
|
|
"--logfile=/tmp/lorax.log",
|
2019-10-09 08:54:48 +00:00
|
|
|
"--dracut-arg=--foo",
|
|
|
|
"--dracut-arg=bar",
|
2019-10-04 12:45:03 +00:00
|
|
|
"/mnt/output_dir"],
|
|
|
|
)
|