From 98a1a5569421b571aa6e775aa0d878c4d8da910b Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Fri, 7 Jul 2017 14:35:08 -0400 Subject: [PATCH 1/3] Remove checksum comparison in CG test. The checksum of the build.log file changes every time because it is (in part) based on the timestamp that the file was written (at the time of the test run). --- tests/test_content_generator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_content_generator.py b/tests/test_content_generator.py index 79b89606..59671401 100644 --- a/tests/test_content_generator.py +++ b/tests/test_content_generator.py @@ -113,6 +113,9 @@ class TestBuild(unittest.TestCase): file_dir = self.cg._prepare_file_directory() ret = self.cg._get_content_generator_metadata(file_dir) rpms_in_tag.assert_called_once() + # Remove checksums for the logs, because they change with time. + del ret['output'][-1]['checksum'] + del expected_output['output'][-1]['checksum'] self.assertEqual(expected_output, ret) @patch("subprocess.Popen") From 0d614e5bdc09f479da83ed3a6db3a7433c84baa0 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Tue, 11 Jul 2017 13:27:54 -0400 Subject: [PATCH 2/3] Revert "Remove checksum comparison in CG test." This reverts commit 98a1a5569421b571aa6e775aa0d878c4d8da910b. --- tests/test_content_generator.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test_content_generator.py b/tests/test_content_generator.py index 59671401..79b89606 100644 --- a/tests/test_content_generator.py +++ b/tests/test_content_generator.py @@ -113,9 +113,6 @@ class TestBuild(unittest.TestCase): file_dir = self.cg._prepare_file_directory() ret = self.cg._get_content_generator_metadata(file_dir) rpms_in_tag.assert_called_once() - # Remove checksums for the logs, because they change with time. - del ret['output'][-1]['checksum'] - del expected_output['output'][-1]['checksum'] self.assertEqual(expected_output, ret) @patch("subprocess.Popen") From a6411bc6b1f8474f5e5152f0de58fdd3b486f5ec Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: Mon, 10 Jul 2017 17:58:25 +0200 Subject: [PATCH 3/3] Clean up logs for build tests --- tests/test_build/test_build.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index 321bf91e..ce7fa5b6 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -23,7 +23,8 @@ import unittest import koji import vcr -from os import path, mkdir +import os +from os import path, mkdir, remove from os.path import dirname from shutil import copyfile @@ -32,7 +33,7 @@ from nose.tools import timed import module_build_service.messaging import module_build_service.scheduler.handlers.repos import module_build_service.utils -from module_build_service import db, models, conf +from module_build_service import db, models, conf, build_logs from mock import patch, PropertyMock @@ -245,6 +246,11 @@ class TestBuild(unittest.TestCase): del sys.modules['moksha.hub'] import moksha.hub.reactor self.vcr.__exit__() + for i in range(20): + try: + os.remove(build_logs.path(i)) + except: + pass @timed(30) @patch('module_build_service.auth.get_user', return_value=user)