Merge branch 'master' of git.calculate.ru:calculate-4/calculate-lib

To add some corrections for test, that was made on other linux system.
packages
Иванов Денис 4 years ago
commit 464a0dd1ae

@ -1,10 +1,17 @@
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y
#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=16
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y

@ -8,3 +8,9 @@ A needle tears a hole
The old familiar sting
Try to kill it all away
But I remember everything.
What have I become
My sweetest friend
Everyone I know
Goes away
In the end

@ -17,15 +17,15 @@
<dir name="apps">
<dir name="gdm">
<dir name="simple-greeter">
<entry mtime="1342486180" name="logo_icon_name" type="string">
<entry name="logo_icon_name" mtime="1342486180" type="string">
<stringvalue>distributor</stringvalue>
</entry>
</dir>
</dir>
<dir name="gnome-terminal">
<dir name="global">
<entry mtime="1342486180" name="use_menu_accelerators" type="bool" value="false"/>
<entry mtime="1342486180" name="use_mnemonics" type="bool" value="false"/>
<entry name="use_menu_accelerators" mtime="1342486180" type="bool" value="false"/>
<entry name="use_mnemonics" mtime="1342486180" type="bool" value="false"/>
</dir>
</dir>
</dir>

@ -621,6 +621,8 @@ class TestTemplateExecutor:
def test_if_the_clear_directory_method_s_input_is_a_path_to_an_existing_empty_directory__the_method_does_nothing(self):
target_path = join_paths(CHROOT_PATH,
'/etc/clear_dir_testfiles/dir_0')
# Делаем директорию пустой.
os.remove(os.path.join(target_path, 'file'))
template_executor._clear_directory(target_path)
assert not os.listdir(target_path)

@ -673,19 +673,24 @@ class TestTemplateWrapper:
assert not template_wrapper.protected
def test_if_a_target_file_is_located_in_a_directory_from_the_protected_mask__the_TemplateWrapper_object_sets_the_protected_flag_as_False(self):
parameters_object = ParametersContainer({'append': 'join',
'format': 'samba'})
try:
template_wrapper = TemplateWrapper(
join_paths(CHROOT_PATH,
'/etc/terminfo/info.json'),
parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error:
pytest.fail("Unexpected exception: {}".format(str(error)))
assert not template_wrapper.protected
if os.environ.get('CONFIG_PROTECT', False):
parameters_object = ParametersContainer({'append': 'join',
'format': 'samba'})
try:
template_wrapper = TemplateWrapper(
join_paths(CHROOT_PATH,
'/etc/terminfo/info.json'),
parameters_object, FILE,
'/path/to/template',
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
except Exception as error:
pytest.fail("Unexpected exception: {}".format(str(error)))
print('PROTECTED SET')
print(template_wrapper._protected_set)
print('UNPROTECTED SET')
print(template_wrapper._unprotected_set)
assert not template_wrapper.protected
# Тестируем проверку хэш-сумм и флаг получаемый в результате нее.
def test_if_a_target_file_is_not_protected__the_TemplateWrapper_sets_the_md5_matching_flag_as_True(self):

@ -6,6 +6,6 @@ obj /etc/dir/deleted.json 11e3a79fe51cce828d973dba8702adaa 1591356795
dir /etc/dir/subdir
obj /etc/dir/subdir/config.json 506649cf099878124deda2c2452c3693 1591605050
obj /etc/dir/subdir/file 84bcceb2c8e6de79849ea5f3304f2411 1591343236
obj /etc/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1591196541
obj /etc/dir/file.conf 0b87fea7f5b65cac5012baa2bf647e72 1594324832
dir /etc/dir/dir_1
obj /etc/dir/dir_1/config.json 506649cf099878124deda2c2452c3693 1591617024
obj /etc/dir/dir_1/config.json 506649cf099878124deda2c2452c3693 1594324832

@ -1,14 +1,19 @@
import pytest
import os
from calculate.utils.files import Process
from subprocess import run, PIPE
CHROOT_PATH = os.path.join(os.getcwd(), 'tests/utils/testfiles/')
@pytest.mark.files_utils
class TestUtils():
def test_if_single_correct_command_executed_using_Process_object__it_successfully_executes(self):
ls_path = os.path.join(CHROOT_PATH, 'etc')
try:
ls_process = Process('ls', '-a', cwd='/')
ls_result = run('ls -a', shell=True, stdout=PIPE, cwd='/')
ls_process = Process('ls', '-a', cwd=ls_path)
ls_result = run('ls -a', shell=True, stdout=PIPE, cwd=ls_path)
except Exception as error:
print('error:', str(error))
assert False

@ -107,8 +107,10 @@ obj /usr/bin/vim 30acc0f256e11c1ecdb1bd80b688d238 1573538056
sym /usr/bin/vimdiff -> vim 1573538053
dir /etc
dir /etc/test_dir_2
obj /etc/test_dir_2/file_2.cfg a371f4d456d471ac0ed0e8befff1cb6d 1586531028
'''
obj /etc/test_dir_2/file_2.cfg a371f4d456d471ac0ed0e8befff1cb6d {}
'''.format(int(os.lstat(os.path.join(CHROOT_PATH,
'etc/test_dir_2/file_2.cfg')).st_mtime))
contents_object.add_obj('/etc/test_dir_2/file_2.cfg')
print('RESULT:')
print(contents_object.render_contents_file())
@ -125,8 +127,10 @@ obj /usr/bin/vim 30acc0f256e11c1ecdb1bd80b688d238 1573538056
sym /usr/bin/vimdiff -> vim 1573538053
dir /etc
dir /etc/test_dir_2
sym /etc/test_dir_2/symlink -> file_2.cfg 1587117567
'''
sym /etc/test_dir_2/symlink -> file_2.cfg {}
'''.format(int(os.lstat(os.path.join(CHROOT_PATH,
'etc/test_dir_2/symlink')).st_mtime))
contents_object.add_sym('/etc/test_dir_2/symlink')
print('RESULT:')
print(contents_object.render_contents_file())

Loading…
Cancel
Save