1
0
mirror of https://github.com/rancher/norman.git synced 2025-07-06 20:10:09 +00:00
norman/condition/condition_test.go
Daishan Peng 643868f4a6 add method to compare if error has tmp file path
add a method to check if the error message contains a tmp file path. It
is to prevent updating resource's condition forever and causing the
controller flapping. https://github.com/rancher/rancher/issues/15103
2018-08-17 15:39:50 -07:00

20 lines
425 B
Go

package condition
import "testing"
func TestRegexp(t *testing.T) {
testInputs := []string{
"create file /tmp/file-uy76324 ",
"/tmp/file-y6123tsd",
}
testOutputs := []string{
"create file file_path_redacted ",
"file_path_redacted",
}
for i, s := range testInputs {
if testOutputs[i] != temfileRegexp.ReplaceAllString(s, "file_path_redacted") {
t.Fatalf("Regexp failed to check %s", testInputs[i])
}
}
}