Skip to content

Commit f93f723

Browse files
committed
fixed conversion
1 parent 4678971 commit f93f723

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

apix/v1alpha2/inferencepool_conversion.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (dst *InferencePool) ConvertFrom(src *v1.InferencePool) error {
8282

8383
func convertStatusToV1(src *InferencePoolStatus) (*v1.InferencePoolStatus, error) {
8484
if src == nil {
85-
return nil, nil
85+
return nil, errors.New("src cannot be nil")
8686
}
8787
u, err := toUnstructured(src)
8888
if err != nil {
@@ -93,7 +93,7 @@ func convertStatusToV1(src *InferencePoolStatus) (*v1.InferencePoolStatus, error
9393

9494
func convertStatusFromV1(src *v1.InferencePoolStatus) (*InferencePoolStatus, error) {
9595
if src == nil {
96-
return nil, nil
96+
return nil, errors.New("src cannot be nil")
9797
}
9898
u, err := toUnstructured(src)
9999
if err != nil {
@@ -104,7 +104,7 @@ func convertStatusFromV1(src *v1.InferencePoolStatus) (*InferencePoolStatus, err
104104

105105
func convertExtensionRefToV1(src *Extension) (*v1.Extension, error) {
106106
if src == nil {
107-
return nil, nil
107+
return nil, errors.New("src cannot be nil")
108108
}
109109
u, err := toUnstructured(src)
110110
if err != nil {
@@ -119,7 +119,7 @@ func convertExtensionRefToV1(src *Extension) (*v1.Extension, error) {
119119

120120
func convertExtensionRefFromV1(src *v1.Extension) (*Extension, error) {
121121
if src == nil {
122-
return nil, nil
122+
return nil, errors.New("src cannot be nil")
123123
}
124124
u, err := toUnstructured(src)
125125
if err != nil {

apix/v1alpha2/inferencepool_conversion_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func TestInferencePoolConvertTo(t *testing.T) {
127127
wantErr: false,
128128
},
129129
{
130-
name: "conversion from v1alpha2 to v1 with nil extensionRef",
130+
name: "conversion from v1alpha2 to v1 with empty extensionRef",
131131
src: &InferencePool{
132132
TypeMeta: metav1.TypeMeta{
133133
Kind: "InferencePool",
@@ -300,7 +300,7 @@ func TestInferencePoolConvertFrom(t *testing.T) {
300300
wantErr: false,
301301
},
302302
{
303-
name: "conversion from v1 to v1alpha2 with nil extensionRef",
303+
name: "conversion from v1 to v1alpha2 with empty extensionRef",
304304
src: &v1.InferencePool{
305305
TypeMeta: metav1.TypeMeta{
306306
Kind: "InferencePool",

0 commit comments

Comments
 (0)