Skip to content

Commit

Permalink
Add fuzz tests for CRDs (#63)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Apr 23, 2020
1 parent 12c1d4f commit b02b054
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/installer/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import (
// Funcs returns the fuzzer functions for this api group.
var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
func(s *v1alpha1.KubeDBCatalog, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
func(s *v1alpha1.KubeDBOperator, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
Expand Down
1 change: 1 addition & 0 deletions apis/installer/install/pruning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ import (

func TestPruneTypes(t *testing.T) {
Install(clientsetscheme.Scheme)
crdfuzz.SchemaFuzzTestForV1beta1CRD(t, clientsetscheme.Scheme, v1alpha1.KubeDBCatalog{}.CustomResourceDefinition(), fuzzer.Funcs)
crdfuzz.SchemaFuzzTestForV1beta1CRD(t, clientsetscheme.Scheme, v1alpha1.KubeDBOperator{}.CustomResourceDefinition(), fuzzer.Funcs)
}
2 changes: 2 additions & 0 deletions apis/installer/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ func Resource(resource string) schema.GroupResource {
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&KubeDBCatalog{},
&KubeDBCatalogList{},
&KubeDBOperator{},
&KubeDBOperatorList{},
)
Expand Down

0 comments on commit b02b054

Please sign in to comment.