Skip to content

Commit c39e7ab

Browse files
committed
Migrate from gofuzz to randfill
1 parent 4137ff3 commit c39e7ab

File tree

27 files changed

+272
-275
lines changed

27 files changed

+272
-275
lines changed

api/addons/v1beta1/conversion_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"reflect"
2323
"testing"
2424

25-
fuzz "github.com/google/gofuzz"
2625
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
2726
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
27+
"sigs.k8s.io/randfill"
2828

2929
addonsv1 "sigs.k8s.io/cluster-api/api/addons/v1beta2"
3030
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
@@ -51,8 +51,8 @@ func ClusterResourceSetFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{}
5151
}
5252
}
5353

54-
func hubClusterResourceSetStatus(in *addonsv1.ClusterResourceSetStatus, c fuzz.Continue) {
55-
c.FuzzNoCustom(in)
54+
func hubClusterResourceSetStatus(in *addonsv1.ClusterResourceSetStatus, c randfill.Continue) {
55+
c.FillNoCustom(in)
5656
// Drop empty structs with only omit empty fields.
5757
if in.Deprecated != nil {
5858
if in.Deprecated.V1Beta1 == nil || reflect.DeepEqual(in.Deprecated.V1Beta1, &addonsv1.ClusterResourceSetV1Beta1DeprecatedStatus{}) {
@@ -61,8 +61,8 @@ func hubClusterResourceSetStatus(in *addonsv1.ClusterResourceSetStatus, c fuzz.C
6161
}
6262
}
6363

64-
func spokeClusterResourceSetStatus(in *ClusterResourceSetStatus, c fuzz.Continue) {
65-
c.FuzzNoCustom(in)
64+
func spokeClusterResourceSetStatus(in *ClusterResourceSetStatus, c randfill.Continue) {
65+
c.FillNoCustom(in)
6666
// Drop empty structs with only omit empty fields.
6767
if in.V1Beta2 != nil {
6868
if reflect.DeepEqual(in.V1Beta2, &ClusterResourceSetV1Beta2Status{}) {

api/bootstrap/kubeadm/v1beta1/conversion_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"reflect"
2323
"testing"
2424

25-
fuzz "github.com/google/gofuzz"
2625
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
2726
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
27+
"sigs.k8s.io/randfill"
2828

2929
bootstrapv1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2"
3030
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
@@ -53,8 +53,8 @@ func KubeadmConfigFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
5353
}
5454
}
5555

56-
func hubKubeadmConfigStatus(in *bootstrapv1.KubeadmConfigStatus, c fuzz.Continue) {
57-
c.FuzzNoCustom(in)
56+
func hubKubeadmConfigStatus(in *bootstrapv1.KubeadmConfigStatus, c randfill.Continue) {
57+
c.FillNoCustom(in)
5858
// Always create struct with at least one mandatory fields.
5959
if in.Deprecated == nil {
6060
in.Deprecated = &bootstrapv1.KubeadmConfigDeprecatedStatus{}
@@ -71,15 +71,15 @@ func hubKubeadmConfigStatus(in *bootstrapv1.KubeadmConfigStatus, c fuzz.Continue
7171
}
7272
}
7373

74-
func spokeKubeadmConfigSpec(in *KubeadmConfigSpec, c fuzz.Continue) {
75-
c.FuzzNoCustom(in)
74+
func spokeKubeadmConfigSpec(in *KubeadmConfigSpec, c randfill.Continue) {
75+
c.FillNoCustom(in)
7676

7777
// Drop UseExperimentalRetryJoin as we intentionally don't preserve it.
7878
in.UseExperimentalRetryJoin = false
7979
}
8080

81-
func spokeKubeadmConfigStatus(in *KubeadmConfigStatus, c fuzz.Continue) {
82-
c.FuzzNoCustom(in)
81+
func spokeKubeadmConfigStatus(in *KubeadmConfigStatus, c randfill.Continue) {
82+
c.FillNoCustom(in)
8383
// Drop empty structs with only omit empty fields.
8484
if in.V1Beta2 != nil {
8585
if reflect.DeepEqual(in.V1Beta2, &KubeadmConfigV1Beta2Status{}) {

api/controlplane/kubeadm/v1beta1/conversion_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
"reflect"
2323
"testing"
2424

25-
fuzz "github.com/google/gofuzz"
2625
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
2726
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
2827
"k8s.io/utils/ptr"
28+
"sigs.k8s.io/randfill"
2929

3030
bootstrapv1beta1 "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1"
3131
controlplanev1 "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2"
@@ -55,8 +55,8 @@ func KubeadmControlPlaneFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{
5555
}
5656
}
5757

58-
func hubKubeadmControlPlaneStatus(in *controlplanev1.KubeadmControlPlaneStatus, c fuzz.Continue) {
59-
c.FuzzNoCustom(in)
58+
func hubKubeadmControlPlaneStatus(in *controlplanev1.KubeadmControlPlaneStatus, c randfill.Continue) {
59+
c.FillNoCustom(in)
6060
// Always create struct with at least one mandatory fields.
6161
if in.Deprecated == nil {
6262
in.Deprecated = &controlplanev1.KubeadmControlPlaneDeprecatedStatus{}
@@ -79,8 +79,8 @@ func hubKubeadmControlPlaneStatus(in *controlplanev1.KubeadmControlPlaneStatus,
7979
}
8080
}
8181

82-
func spokeKubeadmControlPlaneStatus(in *KubeadmControlPlaneStatus, c fuzz.Continue) {
83-
c.FuzzNoCustom(in)
82+
func spokeKubeadmControlPlaneStatus(in *KubeadmControlPlaneStatus, c randfill.Continue) {
83+
c.FillNoCustom(in)
8484
// Drop empty structs with only omit empty fields.
8585
if in.V1Beta2 != nil {
8686
if reflect.DeepEqual(in.V1Beta2, &KubeadmControlPlaneV1Beta2Status{}) {
@@ -98,8 +98,8 @@ func KubeadmControlPlaneTemplateFuzzFuncs(_ runtimeserializer.CodecFactory) []in
9898
}
9999
}
100100

101-
func spokeKubeadmConfigSpec(in *bootstrapv1beta1.KubeadmConfigSpec, c fuzz.Continue) {
102-
c.FuzzNoCustom(in)
101+
func spokeKubeadmConfigSpec(in *bootstrapv1beta1.KubeadmConfigSpec, c randfill.Continue) {
102+
c.FillNoCustom(in)
103103

104104
// Drop UseExperimentalRetryJoin as we intentionally don't preserve it.
105105
in.UseExperimentalRetryJoin = false

0 commit comments

Comments
 (0)