From 79441cc163c1723ca919f1f206c996cf70ed8c85 Mon Sep 17 00:00:00 2001 From: Volodymyr Shypyguzov Date: Mon, 21 Mar 2016 18:59:35 +0200 Subject: [PATCH] Fix logrotate tests In order for logrotate command to return 0 exit status we could call it without -f key for the first time. +Add force parameter to execute_logrotate_cmd helper Change-Id: Id9f7f947a1cc1313795ba693df63e3372028e499 Closes-Bug: #1559014 --- fuelweb_test/tests/test_admin_node.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fuelweb_test/tests/test_admin_node.py b/fuelweb_test/tests/test_admin_node.py index df1455579..bdfcf9a73 100644 --- a/fuelweb_test/tests/test_admin_node.py +++ b/fuelweb_test/tests/test_admin_node.py @@ -106,9 +106,10 @@ class TestLogrotateBase(TestBasic): 'Execution result is: {1}'.format(cmd, result)) @staticmethod - def execute_logrotate_cmd(remote, cmd=None, exit_code=None): + def execute_logrotate_cmd(remote, force=True, cmd=None, exit_code=None): if not cmd: - cmd = 'logrotate -v -f /etc/logrotate.conf' + cmd = 'logrotate -v {0} /etc/logrotate.conf'.format( + '-f' if force else "") result = remote.execute(cmd) logger.debug( 'Results of command {0} execution exit_code:{1} ' @@ -209,7 +210,7 @@ class TestLogrotateBase(TestBasic): 'creation {2}{3}'.format(free, suff, free2, suff2)) self.show_step(4) - self.execute_logrotate_cmd(remote) + self.execute_logrotate_cmd(remote, force=False) free3, suff3 = self.check_free_space(remote) logger.debug('Free space after first ' @@ -349,7 +350,7 @@ class TestLogrotateBase(TestBasic): 'free space after ' 'creation {2}{3}'.format(free, suff, free2, suff2)) self.show_step(4) - self.execute_logrotate_cmd(remote) + self.execute_logrotate_cmd(remote, force=False) free3, suff3 = self.check_free_space(remote) logger.debug('free space after first ' @@ -430,7 +431,7 @@ class TestLogrotateBase(TestBasic): 'free space after ' 'creation {1}'.format(free, free2)) self.show_step(4) - self.execute_logrotate_cmd(remote) + self.execute_logrotate_cmd(remote, force=False) free3 = self.check_free_space(remote, return_as_is=True) logger.debug('Free space after first'