6ab1e7c56c
gates / gates (push) Successful in 20s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
28 lines
900 B
Go
28 lines
900 B
Go
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)
|
|
}
|
|
}
|
|
}
|