survey: describe the Node a host webmail runs on, not the system's #26
No files matched your search
@@ -73,6 +73,13 @@ func TestTheSurveyOffersWhatTheInstallerCanAdd(t *testing.T) {
|
||||
if !strings.Contains(text, "host (with --install-deps: the webmail runs on the installer's own Node") {
|
||||
t.Errorf("a webmail on the host is refused rather than offered:\n%s", text)
|
||||
}
|
||||
if !strings.Contains(text, "node not installed (a host webmail runs on inbuxa's own Node 26; --install-deps adds it)") {
|
||||
t.Errorf("the node line doesn't make the same offer:\n%s", text)
|
||||
}
|
||||
f.Node = host.Node{Present: true, Version: "22.14.0", Major: 22, Path: "/usr/bin/node"}
|
||||
if text := SurveyText(f); !strings.Contains(text, "22.14.0 at /usr/bin/node (not used:") || strings.Contains(text, "too old") {
|
||||
t.Errorf("a system Node is judged rather than reported:\n%s", text)
|
||||
}
|
||||
f.Systemd = false // and this, nothing installs
|
||||
if text := SurveyText(f); !strings.Contains(text, "host (no: a host install needs systemd") {
|
||||
t.Errorf("a machine without systemd is offered a host webmail:\n%s", text)
|
||||
|
||||
+10
-4
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/deps"
|
||||
"git.coffeylabs.org/inbuxa/inbuxa-installer/internal/host"
|
||||
)
|
||||
|
||||
@@ -50,12 +51,17 @@ func SurveyText(f host.Facts) string {
|
||||
}
|
||||
fmt.Fprintf(&b, " %-22s %s\n", "glibc", glibc)
|
||||
|
||||
node := "not installed"
|
||||
// The Node that matters is the installer's own, the one a host webmail
|
||||
// runs on. A system Node is reported, but never judged: it isn't used,
|
||||
// and calling it too old read as a refusal two lines above the offer.
|
||||
node := fmt.Sprintf("not installed (a host webmail runs on inbuxa's own Node %d; --install-deps adds it)", deps.NodeMajor)
|
||||
switch {
|
||||
case f.Node.Present && f.Node.Major >= 22:
|
||||
node = f.Node.Version + " at " + f.Node.Path
|
||||
case f.Node.Present && f.Node.Path == host.OwnPath && f.Node.Major == deps.NodeMajor:
|
||||
node = "inbuxa's own Node " + f.Node.Version + " at " + f.Node.Path
|
||||
case f.Node.Present && f.Node.Path == host.OwnPath:
|
||||
node = fmt.Sprintf("inbuxa's own Node %s at %s (a host webmail needs Node %d)", f.Node.Version, f.Node.Path, deps.NodeMajor)
|
||||
case f.Node.Present:
|
||||
node = f.Node.Version + " (too old for a host install of the webmail)"
|
||||
node = fmt.Sprintf("%s at %s (not used: a host webmail runs on inbuxa's own Node %d; --install-deps adds it)", f.Node.Version, f.Node.Path, deps.NodeMajor)
|
||||
}
|
||||
fmt.Fprintf(&b, " %-22s %s\n", "node", node)
|
||||
if f.Existing != "" {
|
||||
|
||||
Reference in new issue
Block a user