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:
1 parent
0dc784dfa2
commit
87dfca1285
4 files changed
+35
-1
No files matched your search
@@ -136,10 +136,20 @@ 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
|
||||
// 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{}
|
||||
if ports, ok := g["defaultPorts"].([]any); ok {
|
||||
for _, p := range ports {
|
||||
expectPorts = append(expectPorts, fmt.Sprint(p))
|
||||
if !unbound[fmt.Sprint(p)] {
|
||||
expectPorts = append(expectPorts, fmt.Sprint(p))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,3 +106,18 @@ func TestBootTestPayloadAsksForPublishedPortsAndHold(t *testing.T) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user