Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move fuzzers #1852

Merged
merged 3 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apis/duck/v1/fuzzer.go → apis/duck/v1/test/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1
package test

import (
fuzz "github.com/google/gofuzz"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/runtime/serializer"
"knative.dev/pkg/apis"
v1 "knative.dev/pkg/apis/duck/v1"
pkgfuzzer "knative.dev/pkg/apis/testing/fuzzer"
)

Expand All @@ -34,7 +35,7 @@ var testConditions = apis.Conditions{{Type: apis.ConditionReady}, {Type: apis.Co
var FuzzerFuncs = fuzzer.MergeFuzzerFuncs(
func(codecs serializer.CodecFactory) []interface{} {
return []interface{}{
func(status *Status, c fuzz.Continue) {
func(status *v1.Status, c fuzz.Continue) {
c.FuzzNoCustom(status) // fuzz the Status
status.SetConditions(testConditions)
pkgfuzzer.FuzzConditions(status, c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1
package test

import (
"testing"

v1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
Expand All @@ -28,7 +29,7 @@ import (

func TestEventingRoundTripTypesToJSON(t *testing.T) {
scheme := runtime.NewScheme()
utilruntime.Must(AddToScheme(scheme))
utilruntime.Must(v1.AddToScheme(scheme))

fuzzerFuncs := fuzzer.MergeFuzzerFuncs(
pkgfuzzer.Funcs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1
package test

import (
fuzz "github.com/google/gofuzz"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/runtime/serializer"
"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck/v1beta1"
pkgfuzzer "knative.dev/pkg/apis/testing/fuzzer"
)

Expand All @@ -33,7 +34,7 @@ var testConditions = apis.Conditions{{Type: apis.ConditionReady}, {Type: apis.Co
var FuzzerFuncs = fuzzer.MergeFuzzerFuncs(
func(codecs serializer.CodecFactory) []interface{} {
return []interface{}{
func(status *Status, c fuzz.Continue) {
func(status *v1beta1.Status, c fuzz.Continue) {
c.FuzzNoCustom(status) // fuzz the Status
status.SetConditions(testConditions)
pkgfuzzer.FuzzConditions(status, c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1
package test

import (
"testing"

"knative.dev/pkg/apis/duck/v1beta1"

"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
Expand All @@ -28,7 +30,7 @@ import (

func TestEventingRoundTripTypesToJSON(t *testing.T) {
scheme := runtime.NewScheme()
utilruntime.Must(AddToScheme(scheme))
utilruntime.Must(v1beta1.AddToScheme(scheme))

fuzzerFuncs := fuzzer.MergeFuzzerFuncs(
pkgfuzzer.Funcs,
Expand Down