mirror of https://github.com/knative/pkg.git
				
				
				
			found a defaulting bug in the converter for empty addressables. (#1062)
This commit is contained in:
		
							parent
							
								
									8e404c7c40
								
							
						
					
					
						commit
						87875e3b42
					
				|  | @ -82,7 +82,7 @@ func (*Addressable) GetFullType() duck.Populatable { | ||||||
| 
 | 
 | ||||||
| // ConvertUp implements apis.Convertible
 | // ConvertUp implements apis.Convertible
 | ||||||
| func (a *Addressable) ConvertUp(ctx context.Context, to apis.Convertible) error { | func (a *Addressable) ConvertUp(ctx context.Context, to apis.Convertible) error { | ||||||
| 	url := a.GetURL() | 	url := a.URL | ||||||
| 	switch sink := to.(type) { | 	switch sink := to.(type) { | ||||||
| 	case *v1.Addressable: | 	case *v1.Addressable: | ||||||
| 		sink.URL = url.DeepCopy() | 		sink.URL = url.DeepCopy() | ||||||
|  |  | ||||||
|  | @ -128,6 +128,12 @@ func TestConversion(t *testing.T) { | ||||||
| 		conv:        &Addressable{}, | 		conv:        &Addressable{}, | ||||||
| 		wantErrUp:   true, | 		wantErrUp:   true, | ||||||
| 		wantErrDown: true, | 		wantErrDown: true, | ||||||
|  | 	}, { | ||||||
|  | 		name:        "v1alpha1 - empty", | ||||||
|  | 		addr:        &Addressable{}, | ||||||
|  | 		conv:        &Addressable{}, | ||||||
|  | 		wantErrUp:   true, | ||||||
|  | 		wantErrDown: true, | ||||||
| 	}} | 	}} | ||||||
| 
 | 
 | ||||||
| 	for _, test := range tests { | 	for _, test := range tests { | ||||||
|  |  | ||||||
|  | @ -44,6 +44,12 @@ func TestConversion(t *testing.T) { | ||||||
| 		conv:        &v1.Addressable{}, | 		conv:        &v1.Addressable{}, | ||||||
| 		wantErrUp:   false, | 		wantErrUp:   false, | ||||||
| 		wantErrDown: false, | 		wantErrDown: false, | ||||||
|  | 	}, { | ||||||
|  | 		name:        "v1 - empty", | ||||||
|  | 		addr:        &Addressable{}, | ||||||
|  | 		conv:        &v1.Addressable{}, | ||||||
|  | 		wantErrUp:   false, | ||||||
|  | 		wantErrDown: false, | ||||||
| 	}, { | 	}, { | ||||||
| 		name: "v1beta1", | 		name: "v1beta1", | ||||||
| 		addr: &Addressable{ | 		addr: &Addressable{ | ||||||
|  | @ -55,6 +61,12 @@ func TestConversion(t *testing.T) { | ||||||
| 		conv:        &Addressable{}, | 		conv:        &Addressable{}, | ||||||
| 		wantErrUp:   true, | 		wantErrUp:   true, | ||||||
| 		wantErrDown: true, | 		wantErrDown: true, | ||||||
|  | 	}, { | ||||||
|  | 		name:        "v1beta1 - empty", | ||||||
|  | 		addr:        &Addressable{}, | ||||||
|  | 		conv:        &Addressable{}, | ||||||
|  | 		wantErrUp:   true, | ||||||
|  | 		wantErrDown: true, | ||||||
| 	}} | 	}} | ||||||
| 
 | 
 | ||||||
| 	for _, test := range tests { | 	for _, test := range tests { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue