Skip to content

Commit

Permalink
fqdn: add fuzzer
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <adam@adalogics.com>
  • Loading branch information
AdamKorcz authored and ldelossa committed Jan 24, 2023
1 parent 037d1d2 commit 48998a9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/fqdn/fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package fqdn

import (
"testing"

fuzz "github.com/AdaLogics/go-fuzz-headers"

"github.com/cilium/cilium/pkg/policy/api"
)

func FuzzMapSelectorsToIPsLocked(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
ff := fuzz.NewConsumer(data)
fqdnSelectors := make(map[api.FQDNSelector]struct{})
ff.FuzzMap(&fqdnSelectors)
if len(fqdnSelectors) == 0 {
t.Skip()
}
nameManager := NewNameManager(Config{
MinTTL: 1,
Cache: NewDNSCache(0),
})
_, _ = nameManager.MapSelectorsToIPsLocked(fqdnSelectors)
})
}

0 comments on commit 48998a9

Please sign in to comment.