- Review now checks the server before deploying (SSH, root access, OS, CPU, Python, memory, disk, ports 80/443/8448) and resolves every DNS record against the server's addresses. Enter asks twice when a check failed. - Deploys end with the playbook's self-check; results list the services that answered and what failed. Certificate validation is turned off for self-signed setups. - Welcome offers a Manage menu once a server is installed: update, self-check, restart, add a user, close/open registration, back up Postgres to this computer, and view any service's logs. - `interzone bundle` packs the playbook with its roles, Ansible's Python packages and the binary for machines without internet; `unbundle` installs it, and deploys fall back to the bundled copy. - `interzone apply` and `interzone check` run without the TUI. - Invalid YAML in the extra vars and YAML fields is caught on Review. - Screens are roomier: padded body, spaced form fields and sections, two-line component rows, wider cards and separators. - The Server step no longer turns the domain matrix.org into org. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package deploy
|
|
|
|
import "testing"
|
|
|
|
func TestFailureMessage(t *testing.T) {
|
|
line := `fatal: [matrix.example.org -> 127.0.0.1]: FAILED! => {"changed": false, "msg": "Failed checking Element Web is up at ` + "`element.example.org`" + `. Full error: {'status': -1}"}`
|
|
got := failureMessage("Fail if Element Web not working", line)
|
|
want := "Failed checking Element Web is up at `element.example.org`."
|
|
if got != want {
|
|
t.Fatalf("got %q, want %q", got, want)
|
|
}
|
|
if got := failureMessage("Fail if Element Web not working", "fatal: unreachable"); got != "Element Web not working" {
|
|
t.Fatalf("fallback: got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestRedact(t *testing.T) {
|
|
got := redact([]string{"--extra-vars", `{"password":"x","username":"a"}`, "ansible_become_password=y", "plain"})
|
|
want := []string{"--extra-vars", "'<hidden>'", "ansible_become_password=••••", "plain"}
|
|
for i := range want {
|
|
if got[i] != want[i] {
|
|
t.Fatalf("arg %d: got %q, want %q", i, got[i], want[i])
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestWithin(t *testing.T) {
|
|
for name, ok := range map[string]bool{
|
|
"interzone-bundle/playbook/setup.yml": true,
|
|
"../escape": false,
|
|
"a/../../escape": false,
|
|
"/etc/passwd": true, // joined under root, not absolute
|
|
} {
|
|
if _, got := within("/tmp/root", name); got != ok {
|
|
t.Errorf("within(%q) = %v, want %v", name, got, ok)
|
|
}
|
|
}
|
|
}
|