treat empty jobs & empty YAML as valid & ship empty jobs in deb/rpm (#788)

fixes https://github.com/zrepl/zrepl/issues/784
obsoletes https://github.com/zrepl/zrepl/pull/787
This commit is contained in:
Christian Schwarz
2024-05-14 19:18:22 +02:00
committed by GitHub
parent 830536715e
commit 9c63736489
5 changed files with 30 additions and 28 deletions
+18 -1
View File
@@ -22,6 +22,8 @@ func TestSampleConfigsAreParsedWithoutErrors(t *testing.T) {
t.Errorf("glob failed: %+v", err)
}
paths = append(paths, "../packaging/systemd-default-zrepl.yml")
for _, p := range paths {
if path.Ext(p) != ".yml" {
@@ -84,7 +86,7 @@ func trimSpaceEachLineAndPad(s, pad string) string {
func TestTrimSpaceEachLineAndPad(t *testing.T) {
foo := `
foo
bar baz
bar baz
`
assert.Equal(t, " \n foo\n bar baz\n \n", trimSpaceEachLineAndPad(foo, " "))
}
@@ -138,3 +140,18 @@ func TestCronSpec(t *testing.T) {
}
}
func TestEmptyConfig(t *testing.T) {
cases := []string{
"",
"\n",
"---",
"---\n",
}
for _, input := range cases {
config := testValidConfig(t, input)
require.NotNil(t, config)
require.NotNil(t, config.Global)
require.Empty(t, config.Jobs)
}
}