feat(boot-test): test.yaml unboundPorts for ports opened only when a player connects

The first real run of the port check found that the crossplay Minecraft
server opens no UDP socket at startup: Bedrock goes through Geyser's
NetherNet transport, and 19132/udp is not open after boot. It is listed as
unboundPorts in that game's test.yaml, with the reason, until a Bedrock
client confirms how players reach it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gregandClaude Opus 5.5 committed 2026-10-26 00:05:37 -04:00
1 parent 0dc784dfa2
commit 87dfca1285
4 files changed
+34

No files matched your search

+10
View File
@@ -136,12 +136,22 @@ func bootTestPayload(gamesDir, id string, fillBlank bool) (map[string]any, error
} }
} }
// Once up, the server must listen on what nodes publish: the container side of every default port // Once up, the server must listen on what nodes publish: the container side of every default port
// test.yaml's unboundPorts are published but only opened once a player connects; each is listed by
// hand, with the reason in a comment
unbound := map[string]bool{}
if list, ok := test["unboundPorts"].([]any); ok {
for _, p := range list {
unbound[fmt.Sprint(p)] = true
}
}
expectPorts := []any{} expectPorts := []any{}
if ports, ok := g["defaultPorts"].([]any); ok { if ports, ok := g["defaultPorts"].([]any); ok {
for _, p := range ports { for _, p := range ports {
if !unbound[fmt.Sprint(p)] {
expectPorts = append(expectPorts, fmt.Sprint(p)) expectPorts = append(expectPorts, fmt.Sprint(p))
} }
} }
}
return map[string]any{ return map[string]any{
"command": "DEPLOY_SERVER", "command": "DEPLOY_SERVER",
+15
View File
@@ -106,3 +106,18 @@ func TestBootTestPayloadAsksForPublishedPortsAndHold(t *testing.T) {
t.Errorf("missing secret: %v", err) t.Errorf("missing secret: %v", err)
} }
} }
func TestBootTestPayloadLeavesOutUnboundPorts(t *testing.T) {
dir := t.TempDir()
game := filepath.Join(dir, "example")
os.MkdirAll(game, 0o755)
os.WriteFile(filepath.Join(game, "game.yaml"), []byte("id: example\nname: Example\ndefaultDockerImage: x\ndefaultPorts:\n - 30000/tcp\n - 30001/udp\n"), 0o644)
os.WriteFile(filepath.Join(game, "test.yaml"), []byte("unboundPorts:\n - 30001/udp\n"), 0o644)
p, err := bootTestPayload(dir, "example", false)
if err != nil {
t.Fatal(err)
}
if ports := p["expectPorts"].([]any); len(ports) != 1 || ports[0] != "30000/tcp" {
t.Errorf("expectPorts %v", ports)
}
}
+4
View File
@@ -4,3 +4,7 @@ config:
EULA: true EULA: true
readyExample: '[21:37:42 INFO]: Done (16.390s)! For help, type "help"' readyExample: '[21:37:42 INFO]: Done (16.390s)! For help, type "help"'
timeoutSec: 900 timeoutSec: 900
# Bedrock players go through Geyser's NetherNet transport (see JVM_OPTS), which opens no UDP socket at
# startup: after boot the server listens on 25565/tcp and 19132/tcp only. To verify with a Bedrock client.
unboundPorts:
- 19132/udp
+5
View File
@@ -33,6 +33,11 @@
"minimum": 10, "minimum": 10,
"maximum": 3600 "maximum": 3600
}, },
"unboundPorts": {
"description": "Published ports the server only opens once a player connects, so the boot test doesn't expect them open. Each one exactly as in defaultPorts, with the reason in a comment.",
"type": "array",
"items": { "type": "string" }
},
"holdSec": { "holdSec": {
"description": "How long the server must stay up after its ready line to pass (default 60). Its published ports are checked after it.", "description": "How long the server must stay up after its ready line to pass (default 60). Its published ports are checked after it.",
"type": "integer", "type": "integer",