Properly copy gerrit static files

Dockerfile's COPY directive only copies the contents of a directory when
src is a directory. It does not copy the directory itself. This meant
the copy we were using to copy static files put them in /var/gerrit and
not /var/gerrit/static where we need them to be.

Update the Dockerfile to copy to /var/gerrit/static/ to fix this and add
some resource fetching tests to ensure they are served correctly.

Change-Id: I3bb4c06f3d7a57dcfccbbdb27cb8405586949949
This commit is contained in:
Clark Boylan 2021-09-27 13:28:26 -07:00
parent bcb437237a
commit 7df09ecef5
2 changed files with 17 additions and 1 deletions

View File

@ -23,6 +23,7 @@ RUN mkdir /var/gerrit/plugins && \
# NOTE(ianw) : copied into build context by playbooks/zuul/gerrit/run.yaml
COPY plugins/opendevtheme.html /var/gerrit/plugins/opendevtheme.html
COPY static/ /var/gerrit/
# Copy copies only the contents of a directory not the directory itself.
COPY static/ /var/gerrit/static/
COPY bazel-bin/plugins/zuul-results-summary/zuul-results-summary.jar /var/gerrit/plugins/zuul-results-summary.jar

View File

@ -50,3 +50,18 @@ def test_gerrit_screenshot(host):
)
take_screenshots(host, shots)
def test_opendev_logo(host):
cmd = host.run('curl --head --insecure '
'--resolve review.opendev.org:443:127.0.0.1 '
'https://review.opendev.org/static/opendev-sm.png')
assert '200 OK' in cmd.stdout
assert 'Content-Type: image/png' in cmd.stdout
def test_openstack_cla(host):
cmd = host.run('curl --include --insecure '
'--resolve review.opendev.org:443:127.0.0.1 '
'https://review.opendev.org/static/cla.html')
assert '200 OK' in cmd.stdout
assert 'Content-Type: text/html' in cmd.stdout
assert 'OpenStack Project Individual Contributor License Agreement' in cmd.stdout