From 3bf36b71281c2c65d9bb311da7678c25f5eabfef Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Thu, 10 Jan 2019 14:04:17 +1100 Subject: [PATCH] Don't validate .placeholder When creating a new election we need to add a directory per project (including the 'TC' as a pseudo project) we can't just create an empty directory in git so we add a '.placeholder' file. We have recently added a voting job that will run try to validate all candidate files added in a review. This includes the placeholder file. CLearly this file will not pass validation and cause the job to fail. Adding .placeholder to the zuul irrelevant-files variable wont work, so instead filter .placeholder from the interesting files. Change-Id: Ibd2224a5479d4ab9afbac227bac38080359a98bf --- openstack_election/cmds/ci_check_all_candidate_files.py | 3 ++- openstack_election/tests/cmds/test_ci_checks.py | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/openstack_election/cmds/ci_check_all_candidate_files.py b/openstack_election/cmds/ci_check_all_candidate_files.py index bf7fdffc..4a85bce7 100755 --- a/openstack_election/cmds/ci_check_all_candidate_files.py +++ b/openstack_election/cmds/ci_check_all_candidate_files.py @@ -84,7 +84,8 @@ def find_modified_candidate_files(): filenames = [ l.strip() for l in results.splitlines() - if l.startswith(utils.CANDIDATE_PATH + '/') + if (l.startswith(utils.CANDIDATE_PATH + '/') and + not l.endswith('.placeholder')) ] return filenames diff --git a/openstack_election/tests/cmds/test_ci_checks.py b/openstack_election/tests/cmds/test_ci_checks.py index 3003f171..9ff27ef8 100644 --- a/openstack_election/tests/cmds/test_ci_checks.py +++ b/openstack_election/tests/cmds/test_ci_checks.py @@ -35,7 +35,7 @@ class TestFindModifiedCandidateFiles(base.ElectionTestCase): check_output = (('configuration.yaml\n' '%(path)s/.placeholder\n' ) % ({'path': utils.CANDIDATE_PATH})).encode('utf-8') - expected_filenames = ['%s/.placeholder' % utils.CANDIDATE_PATH] + expected_filenames = [] mock_check_output.return_value = check_output filenames = \ ci_check_all_candidate_files.find_modified_candidate_files() @@ -48,9 +48,7 @@ class TestFindModifiedCandidateFiles(base.ElectionTestCase): '%(path)s/cadidate\n' '%(path)s/.placeholder\n' ) % ({'path': utils.CANDIDATE_PATH})).encode('utf-8') - expected_filenames = ['%s/cadidate' % utils.CANDIDATE_PATH, - '%s/.placeholder' % utils.CANDIDATE_PATH - ] + expected_filenames = ['%s/cadidate' % utils.CANDIDATE_PATH] mock_check_output.return_value = check_output filenames = \ ci_check_all_candidate_files.find_modified_candidate_files()