Update
DevPlace CI / test (push) Failing after 1h28m53s

This commit is contained in:
2026-09-03 08:47:57 +02:00
parent 70ceb3cf81
commit 3d07a478c3
41 changed files with 1643 additions and 130 deletions
+56
View File
@@ -107,3 +107,59 @@ def test_http_ingress_proxy(app_server):
httpd.shutdown()
get_table("instances").delete(uid=uid)
refresh_snapshot()
def test_http_ingress_proxy_injects_a_base_into_the_root_document_only(app_server):
import http.server
import socket
import socketserver
import threading
sock = socket.socket()
sock.bind(("127.0.0.1", 0))
port = sock.getsockname()[1]
sock.close()
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.end_headers()
self.wfile.write(
b"<!doctype html><html><head><title>t</title></head>"
b"<body><script src='app.js'></script></body></html>"
)
def log_message(self, *args):
pass
httpd = socketserver.TCPServer(("127.0.0.1", port), Handler)
thread = threading.Thread(target=httpd.serve_forever, daemon=True)
thread.start()
slug = f"base{port}"
uid = f"basetest-{port}"
get_table("instances").insert(
{
"uid": uid,
"name": "ingress-base",
"project_uid": "ingtest",
"status": "running",
"ingress_slug": slug,
"ingress_port": 8000,
"ports_json": f'[{{"host": {port}, "container": 8000, "proto": "tcp"}}]',
"deleted_at": None,
"deleted_by": None,
}
)
refresh_snapshot()
try:
root = requests.get(f"{BASE_URL}/p/{slug}")
assert root.status_code == 200, root.text
assert f'<base href="/p/{slug}/">' in root.text
nested = requests.get(f"{BASE_URL}/p/{slug}/static/webview/pre/index.html")
assert nested.status_code == 200, nested.text
assert "<base" not in nested.text
finally:
httpd.shutdown()
get_table("instances").delete(uid=uid)
refresh_snapshot()