Let operators manage ordered action groups on each host, run them manually or on a schedule over SSH, and inspect disk-backed JSON run logs from a node detail UI.
19 lines
535 B
Go
19 lines
535 B
Go
package auth
|
|
|
|
import "testing"
|
|
|
|
func TestExpandPlaceholders(t *testing.T) {
|
|
body := "ping {{node.ip}} as {{node.username}} host={{cc.host}} env={{env.FOO}} secret={{secret.TOKEN}} unknown={{nope}}"
|
|
got := ExpandPlaceholders(body, PlaceholderContext{
|
|
Host: "web-1",
|
|
IP: "10.0.0.5",
|
|
Username: "deploy",
|
|
Env: map[string]string{"FOO": "bar"},
|
|
Secrets: map[string]string{},
|
|
})
|
|
want := "ping 10.0.0.5 as deploy host=web-1 env=bar secret= unknown="
|
|
if got != want {
|
|
t.Fatalf("got %q want %q", got, want)
|
|
}
|
|
}
|