Move socket test server file into spec dir

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-12 17:10:07 -07:00
parent 74632be2e1
commit 63f50820bd
2 changed files with 12 additions and 6 deletions

View File

@ -104,14 +104,20 @@ describe "http://miti.sh/posts", ->
assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts"
describe "http://git.miti.sh", ->
it "reverse proxies request to unix socket", ->
os.execute "mkdir /run/gitea"
p = io.popen "luajit unixstreamsrvr.lua"
os.execute("sleep 1")
os.execute("chown -R nobody /run/gitea")
it "reverse proxies request to gitea through a unix socket", ->
Path = require "sitegen.path"
filename = "unixstreamsrvr.lua"
socket_dir = "/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"
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", ->
it "doesn't find it", ->