Skip to content

Commit

Permalink
test: add a fuzz test
Browse files Browse the repository at this point in the history
  • Loading branch information
binbin-li committed May 6, 2024
1 parent 6dfa8e8 commit 0629221
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions pkg/utils/utils_fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright The Ratify Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package utils

import "testing"

func FuzzParseSubjectReference(f *testing.F) {
testcases := []string{"localhost:5000/net&monitor:v1", "prom/prometheus", "net-monitor@sha256:a0fc570a245b09ed752c42d600ee3bb5b4f77bbd70d8898780b7ab43454530eb"}
for _, tc := range testcases {
f.Add(tc)
}
f.Fuzz(func(t *testing.T, input string) {
_, err := ParseSubjectReference(input)
if err != nil {
return
}
})
}

0 comments on commit 0629221

Please sign in to comment.