VictoriaMetrics/lib/envtemplate/envtemplate_test.go
Aliaksandr Valialkin 60c7397be5 all: support %{ENV_VAR} placeholders in yaml configs in all the vm* components
Such placeholders are substituted by the corresponding environment variable values.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/583
2020-08-13 17:17:06 +03:00

20 lines
382 B
Go

package envtemplate
import (
"testing"
)
func TestReplace(t *testing.T) {
f := func(s, resultExpected string) {
t.Helper()
result := Replace([]byte(s))
if string(result) != resultExpected {
t.Fatalf("unexpected result;\ngot\n%q\nwant\n%q", result, resultExpected)
}
}
f("", "")
f("foo", "foo")
f("%{foo}", "%{foo}")
f("foo %{bar} %{baz}", "foo %{bar} %{baz}")
}