feat: import Sea vHost single-server testing release

This commit is contained in:
canglan committed 2026-10-30 08:39:10 +08:00
commit 248badd33e
441 files changed
+63221

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
//go:build linux
package main
import (
"sea-vhost/internal/hosting"
"testing"
)
func TestJavaInvocationOnlyUsesProtectedState(t *testing.T) {
v := hosting.RunnerConfig{Binary: "/www/server/java/jdk-25/bin/java", Arguments: []string{"-jar", "/www/wwwroot/host/app.jar"}}
good := []string{"runner", "sv0123456789", "--java", v.Binary, v.Arguments[1]}
if !validInvocation(good, v) {
t.Fatal("expected matching Java invocation")
}
for _, args := range [][]string{{"runner", "sv0123456789", "--java", "/bin/sh", v.Arguments[1]}, {"runner", "sv0123456789", "--java", v.Binary, "/tmp/foreign.jar"}, {"runner", "sv0123456789", "--command", v.Binary, v.Arguments[1]}} {
if validInvocation(args, v) {
t.Fatal("accepted foreign launcher command")
}
}
}