From a94d081004675a1dcd8fac1f399c4b89b12cd142 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 3 May 2017 15:16:16 -0500 Subject: [PATCH] Add check for git-http-backend This allows for more graceful test failures when the libexec dir is different from what the test class determines it should be. --- .../file/base/git_pillar/http/files/uwsgi.yml | 2 +- tests/support/gitfs.py | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/integration/files/file/base/git_pillar/http/files/uwsgi.yml b/tests/integration/files/file/base/git_pillar/http/files/uwsgi.yml index 97f95a489d..2b4b0b2714 100644 --- a/tests/integration/files/file/base/git_pillar/http/files/uwsgi.yml +++ b/tests/integration/files/file/base/git_pillar/http/files/uwsgi.yml @@ -1,6 +1,6 @@ uwsgi: socket: 127.0.0.1:{{ pillar['git_pillar']['uwsgi_port'] }} - cgi: {{ salt['pillar.get']('git_pillar:libexec_dir', '/usr/libexec') }}/git-core/git-http-backend + cgi: {{ pillar['git_pillar']['git-http-backend'] }} chdir: %d daemonize: {{ pillar['git_pillar']['config_dir'] }}/uwsgi.log pidfile: {{ pillar['git_pillar']['config_dir'] }}/uwsgi.pid diff --git a/tests/support/gitfs.py b/tests/support/gitfs.py index 3437913beb..1825c99d2d 100644 --- a/tests/support/gitfs.py +++ b/tests/support/gitfs.py @@ -210,15 +210,28 @@ class WebserverMixin(ModuleCase, ProcessManager, SaltReturnAssertsMixin): 'uwsgi_port': self.uwsgi_port, 'auth_enabled': auth_enabled}} - if grains['os_family'] in ('Debian', 'Arch'): - # Different libexec dir for git backend on Debian-based systems - pillar['git_pillar']['libexec_dir'] = '/usr/lib' + # Different libexec dir for git backend on Debian-based systems + git_core = '/usr/libexec/git-core' \ + if grains['os_family'] in ('RedHat') \ + else '/usr/lib/git-core' + + pillar['git_pillar']['git-http-backend'] = os.path.join( + git_core, + 'git-http-backend') ret = self.run_function( 'state.apply', mods='git_pillar.http', pillar=pillar) + if not os.path.exists(pillar['git_pillar']['git-http-backend']): + self.fail( + '{0} not found. Either git is not installed, or the test ' + 'class needs to be updated.'.format( + pillar['git_pillar']['git-http-backend'] + ) + ) + try: self.nginx_proc = self.wait_proc(name='nginx', search=self.nginx_conf)