Add tests for nginx.conf directives #1

Merged
ccm merged 26 commits from ccm-test-nginx-directives into trunk 2025-06-14 21:54:22 +00:00
2 changed files with 12 additions and 6 deletions
Showing only changes of commit 63f50820bd - Show all commits

View File

@ -104,14 +104,20 @@ describe "http://miti.sh/posts", ->
assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts" assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts"
describe "http://git.miti.sh", -> describe "http://git.miti.sh", ->
it "reverse proxies request to unix socket", -> it "reverse proxies request to gitea through a unix socket", ->
os.execute "mkdir /run/gitea" Path = require "sitegen.path"
p = io.popen "luajit unixstreamsrvr.lua" filename = "unixstreamsrvr.lua"
os.execute("sleep 1") socket_dir = "/run/gitea"
os.execute("chown -R nobody /run/gitea") info = debug.getinfo 1
basepath = Path.basepath info.short_src
os.execute "mkdir " .. socket_dir
p = io.popen "luajit %s"\format Path.join basepath, filename
os.execute "sleep 0"
os.execute "chown -R nobody " .. socket_dir
request = req "http://git.miti.sh" request = req "http://git.miti.sh"
assert.is_not_nil p\read"*a"\match "Host: git.miti.sh" assert.truthy p\read"*a"\match "Host: git.miti.sh"
describe "http://apps.miti.sh", -> describe "http://apps.miti.sh", ->
it "doesn't find it", -> it "doesn't find it", ->