diff --git a/testinfra/test_gitea.py b/testinfra/test_gitea.py index 7a698a3350..a3eb86be2c 100644 --- a/testinfra/test_gitea.py +++ b/testinfra/test_gitea.py @@ -112,6 +112,26 @@ def test_partial_project_clone(host): assert "refs/remotes/origin/main" not in cmd.stdout assert cmd.succeeded +def test_no_500_template_content(host): + # We discovered that gitea template rendering errors produce 500 errors + # in the rendered template but not in our http response codes. Check a + # number of pages for 500 errors in the html response. + paths_to_check = [ + '/', + '/opendev/system-config', + '/opendev/system-config/src/branch/master/playbooks/roles/gitea/tasks/main.yaml', + '/explore/repos', + '/explore/users', + '/explore/organizations', + '/explore/code?q=gitea&t=', + ] + for path in paths_to_check: + cmd = host.run('curl --insecure ' + '--resolve gitea99.opendev.org:3081:127.0.0.1 ' + 'https://gitea99.opendev.org:3081' + path) + assert 'status-page-500' not in cmd.stdout + assert 'Internal Server Error' not in cmd.stdout + def test_gitea_screenshots(host): shots = (