Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Prove the avatar fallback on any machine
The page without icons was checked only where cgit's Lua lacked
luaossl, so a machine that has it never ran the fallback. It now runs
with every Lua search path pointed at an empty directory, and the log
line is compared whole. Writing the config needs no Lua, so that step
runs everywhere too.
| -rw-r--r-- | tests/extensions/test-email-avatar.lua | 3 | |
| -rwxr-xr-x | tests/t0504-email-avatar.sh | 25 |
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/extensions/test-email-avatar.lua b/tests/extensions/test-email-avatar.lua index 199b4ac..40375c8 100644 --- a/tests/extensions/test-email-avatar.lua +++ b/tests/extensions/test-email-avatar.lua @@ -27,7 +27,8 @@ end h.load(script) if mode == "missing" then - h.contains("a missing luaossl is named in the error log", h.error_log(), "Unable to load openssl.digest") + h.equals("a missing luaossl is named in the error log", h.error_log(), + "[cgit] Unable to load openssl.digest, so no avatar icons are drawn\n") else h.equals("with luaossl the error log stays empty", h.error_log(), "") end diff --git a/tests/t0504-email-avatar.sh b/tests/t0504-email-avatar.sh index 342daee..dc00426 100755 --- a/tests/t0504-email-avatar.sh +++ b/tests/t0504-email-avatar.sh @@ -6,8 +6,9 @@ # deterministic digest standing in for luaossl, with the module made to # fail to load, and once more against the real module wherever it is # installed, which adds the check that a known address hashes to its SHA-256. -# Through cgit itself the answer depends on whether the binary's own Lua has -# luaossl, so it is probed for rather than assumed. +# Through cgit itself the icon is checked wherever a probe finds luaossl in +# the binary's own Lua, and the fallback with every Lua module kept off the +# search path, which gives it on any machine. test_description='Check the shipped email avatar extensions' CGIT_TEST_NO_CREATE_REPOS=YesPlease @@ -45,13 +46,9 @@ test_expect_success 'create a repository with one commit' ' if cgit_lua_probe "$PWD/repos/avatar/.git" openssl.digest then test_set_prereq CGIT_LUA_OSSL -elif test "$CGIT_HAS_LUA" -eq 1 -then - test_set_prereq CGIT_LUA_NOOSSL - say 'cgit lua has no luaossl, expecting names without icons' fi -test_expect_success CGIT_LUA 'point cgit at it through the email filter' ' +test_expect_success 'point cgit at it through the email filter' ' cat >cgitrc <<-EOF virtual-root=/ cache-size=0 @@ -69,12 +66,14 @@ test_expect_success CGIT_LUA_OSSL 'the commit page draws the author icon' ' test_grep "loading=.lazy." tmp ' -test_expect_success CGIT_LUA_NOOSSL 'without luaossl the page keeps the name alone' ' - cgit_url "avatar/commit/" >tmp 2>err && - grep "A U Thor" tmp && - ! grep "<img src=.https:" tmp && - ! grep "Unable to complete the request" tmp && - grep "Unable to load openssl.digest" err +test_expect_success CGIT_LUA 'without luaossl the page keeps the name alone' ' + echo "[cgit] Unable to load openssl.digest, so no avatar icons are drawn" >expect && + without_lua_modules cgit_url "avatar/commit/" >tmp 2>err && + test_cmp expect err && + test_grep "^Status: 200" tmp && + test_grep "</html>" tmp && + test_grep "A U Thor" tmp && + test_grep ! "<img src=.https:" tmp ' test_done |
