package wgtunnel import ( "strings" "testing" "gitea.dooplex.hu/admin/felhom-agent/internal/privapplytest" ) // R-861: the conf renderConf writes (with and without the operator OOB peer) is accepted; a PostUp line is not. func TestPrivApply_AcceptsTheRenderedConf(t *testing.T) { priv := "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=" b := testBlock("CQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQk=") for _, oob := range []string{"", "10.77.0.250"} { b.OOBPeerIP = oob conf, err := renderConf(b, priv, "49.12.1.2") if err != nil { t.Fatal(err) } if got := privapplytest.Check(t, "wg", "", conf); got != "OK" { t.Errorf("rendered conf (oob=%q): %s", oob, got) } if got := privapplytest.Check(t, "wg", "", strings.Replace(conf, "MTU = 1280", "MTU = 1280\nPostUp = id", 1)); !strings.HasPrefix(got, "REFUSED") { t.Fatalf("control: PostUp was not refused: %s", got) } } }