Add unittests for logrotate

Please find unit test code for logrotate.