Something went wrong. Try again.
Runs Claude Code sessions in Kubernetes on long-running work you review on your forge
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647package v1alpha1
import "testing"
var exampleConsole = map[string]any{ "home": map[string]any{"path": "/home/person"}, "workspace": map[string]any{"repositories": []any{ map[string]any{"url": "git@forge.example:person/personal.git"}, map[string]any{"url": "https://knot.example/did:plc:abc", "path": "knot.example/person/notes"}, }}, "tools": map[string]any{"mcp": []any{"prometheus"}}, "grants": map[string]any{"clusterRoles": []any{"view"}}, "connectors": map[string]any{"disabled": []any{"claude.ai Gmail"}}, "template": map[string]any{"metadata": map[string]any{"labels": map[string]any{"gofer.guid.foo/profile": "personal"}}},}
func repository(fields map[string]any) map[string]any { return with(exampleConsole, map[string]any{"workspace": map[string]any{"repositories": []any{fields}}})}
func TestTheAPIServerAcceptsAndRefusesAConsole(t *testing.T) { cases := []struct { name string spec map[string]any refusal string }{ {"the example of the plan", exampleConsole, ""}, {"only a home", map[string]any{"home": map[string]any{"path": "/home/person"}}, ""}, {"no home", with(exampleConsole, map[string]any{"home": nil}), "spec.home: Required value"}, {"a relative home", with(exampleConsole, map[string]any{"home": map[string]any{"path": "home/person"}}), "spec.home.path"}, {"a home size", with(exampleConsole, map[string]any{"home": map[string]any{"path": "/home/person", "size": "100Gi"}}), ""}, {"a home size that is no quantity", with(exampleConsole, map[string]any{"home": map[string]any{"path": "/home/person", "size": "lots"}}), "spec.home.size"}, {"a working directory outside the home", with(exampleConsole, map[string]any{"workspace": map[string]any{"directory": "../src"}}), "spec.workspace.directory"}, {"an absolute working directory", with(exampleConsole, map[string]any{"workspace": map[string]any{"directory": "/src"}}), "spec.workspace.directory"}, {"a repository with no URL", repository(map[string]any{"path": "forge.example/personal"}), "url: Required value"}, {"a repository path outside the directory", repository(map[string]any{"url": "u", "path": "../personal"}), "path"}, {"an absolute repository path", repository(map[string]any{"url": "u", "path": "/personal"}), "path"}, {"another permission mode", with(exampleConsole, map[string]any{"permissionMode": "yolo"}), "Unsupported value"}, {"the plan permission mode", with(exampleConsole, map[string]any{"permissionMode": "plan"}), ""}, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { verdict(t, validate(t, ConsoleKind, resource(ConsoleKind, c.spec), nil), c.refusal) }) }}