Trim trailing spaces and tabs from config map files

This commit is contained in:
Phani Teja Marupaka
2020-01-02 10:28:03 -08:00
parent 3577a7e174
commit fa8f504ff4
3 changed files with 26 additions and 7 deletions

View File

@@ -95,3 +95,13 @@ func TestKeyValuesFromFileSources(t *testing.T) {
}
}
}
func TestTrimTrailingSpacesInLines(t *testing.T) {
kvl := makeKvLoader(filesys.MakeFsInMemory())
input := "\"fooKey\": \"fooValue\" \t\n\t\"barKey\": \"barValue\""
expected := "\"fooKey\": \"fooValue\"\n\t\"barKey\": \"barValue\""
res := kvl.trimTrailingSpacesInLines(input)
if !reflect.DeepEqual(res, expected) {
t.Errorf("Trim trailing spaces in lines should succeed, got: %s exptected: %s", res, expected)
}
}