Skip to content

Commit b214359

Browse files
committed
fixup conversion tests
1 parent ed71966 commit b214359

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

exp/runtime/api/v1alpha1/conversion_test.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ limitations under the License.
1919
package v1alpha1
2020

2121
import (
22+
"reflect"
2223
"testing"
2324

25+
fuzz "github.com/google/gofuzz"
2426
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
2527
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
2628

@@ -39,5 +41,28 @@ func TestFuzzyConversion(t *testing.T) {
3941
}
4042

4143
func ExtensionConfigFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
42-
return []interface{}{}
44+
return []interface{}{
45+
hubExtensionConfigStatus,
46+
spokeExtensionConfigStatus,
47+
}
48+
}
49+
50+
func hubExtensionConfigStatus(in *addonsv1.ExtensionConfigStatus, c fuzz.Continue) {
51+
c.FuzzNoCustom(in)
52+
// Drop empty structs with only omit empty fields.
53+
if in.Deprecated != nil {
54+
if in.Deprecated.V1Beta1 == nil || reflect.DeepEqual(in.Deprecated.V1Beta1, &addonsv1.ExtensionConfigV1Beta1DeprecatedStatus{}) {
55+
in.Deprecated = nil
56+
}
57+
}
58+
}
59+
60+
func spokeExtensionConfigStatus(in *ExtensionConfigStatus, c fuzz.Continue) {
61+
c.FuzzNoCustom(in)
62+
// Drop empty structs with only omit empty fields.
63+
if in.V1Beta2 != nil {
64+
if reflect.DeepEqual(in.V1Beta2, &ExtensionConfigV1Beta2Status{}) {
65+
in.V1Beta2 = nil
66+
}
67+
}
4368
}

0 commit comments

Comments
 (0)