Skip to content

Commit b0184bb

Browse files
committed
add fuzz test in internal/source
1 parent 852425a commit b0184bb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal/source/source_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"testing"
2626
"time"
2727

28+
fuzz "github.com/AdaLogics/go-fuzz-headers"
2829
"github.com/ProtonMail/go-crypto/openpgp"
2930
extgogit "github.com/go-git/go-git/v5"
3031
"github.com/go-git/go-git/v5/config"
@@ -86,6 +87,18 @@ func init() {
8687
log.SetLogger(logr.New(log.NullLogSink{}))
8788
}
8889

90+
func Fuzz_templateMsg(f *testing.F) {
91+
f.Add("template", []byte{})
92+
f.Add("", []byte{})
93+
94+
f.Fuzz(func(t *testing.T, template string, seed []byte) {
95+
var values TemplateData
96+
fuzz.NewConsumer(seed).GenerateStruct(&values)
97+
98+
_, _ = templateMsg(template, &values)
99+
})
100+
}
101+
89102
func TestNewSourceManager(t *testing.T) {
90103
namespace := "test-ns"
91104
gitRepoName := "foo"

0 commit comments

Comments
 (0)