CI / test (push) Failing after 7m1s
slurm.shared mounts the site's NFS export, has an llmgw node export the path over NFS to the Slurm machines alone (2049 in the firewall), or looks for a file system the site mounts. slurm.users "llmgw" makes each active account a Linux user on every Slurm machine: login from its e-mail, a UID from 200000 kept in slurm_users and never reused, its home on the shared path, its SSH keys from the portal's Profile (or ctl slurm users keys) read by sshd from /etc/llmgw/ssh-keys. server init --slurm chooses /shared from the first machine and llmgw's users; --slurm-shared and --slurm-users change that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package slurm
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestExportsAndMountUnit(t *testing.T) {
|
|
e := Exports("/shared", []string{"10.0.0.22", "10.0.0.21", "10.0.0.22"})
|
|
if !strings.Contains(e, `"/shared" 10.0.0.21(rw,sync,no_subtree_check,root_squash) 10.0.0.22(rw,`) ||
|
|
strings.Count(e, "10.0.0.22") != 1 {
|
|
t.Fatalf("exports:\n%s", e)
|
|
}
|
|
if strings.Contains(Exports("/shared", nil), "/shared\"") {
|
|
t.Fatal("an export to nobody")
|
|
}
|
|
for path, want := range map[string]string{"/shared": "shared.mount", "/data/hpc": "data-hpc.mount",
|
|
"/hpc-data": `hpc\x2ddata.mount`, "/.b": `\x2eb.mount`} {
|
|
if got := MountUnitName(path); got != want {
|
|
t.Errorf("%s: %s, want %s", path, got, want)
|
|
}
|
|
}
|
|
if u := MountUnit("10.0.0.11:/shared", "/shared"); !strings.Contains(u, "What=10.0.0.11:/shared\nWhere=/shared\nType=nfs") {
|
|
t.Fatalf("unit:\n%s", u)
|
|
}
|
|
}
|
|
|
|
func TestParseSSHKeys(t *testing.T) {
|
|
key := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILq3vMdLAKlaDdxwrSgCtP/j/qrF4nzxNBNGuJmK5vxh"
|
|
got, err := ParseSSHKeys("# mine\n\n" + key + " ayse@laptop \n" + key + " ayse@laptop\n")
|
|
if err != nil || len(got) != 1 || got[0] != key+" ayse@laptop" {
|
|
t.Fatalf("%q %v", got, err)
|
|
}
|
|
for _, bad := range []string{"not a key", `command="rm -rf /" ` + key} {
|
|
if _, err := ParseSSHKeys(bad); err == nil {
|
|
t.Errorf("%q taken", bad)
|
|
}
|
|
}
|
|
if !ValidLogin("ali_veli") || ValidLogin("9x") || ValidLogin("Ayse") {
|
|
t.Error("ValidLogin")
|
|
}
|
|
}
|