Skip to content

Commit 89fd00c

Browse files
committed
Add a test to ensure we can handle alt client-go versions
Test to ensure istio/api#3127 work doesn't cause regressions
1 parent 0e57b81 commit 89fd00c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pilot/pkg/config/kube/crdclient/client_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package crdclient
1616

1717
import (
18+
"context"
1819
"fmt"
1920
"reflect"
2021
"testing"
@@ -27,7 +28,9 @@ import (
2728

2829
"istio.io/api/meta/v1alpha1"
2930
"istio.io/api/networking/v1alpha3"
31+
"istio.io/api/networking/v1beta1"
3032
clientnetworkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3"
33+
apiistioioapinetworkingv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1"
3134
"istio.io/istio/pilot/pkg/model"
3235
"istio.io/istio/pkg/config"
3336
"istio.io/istio/pkg/config/schema/collection"
@@ -433,3 +436,16 @@ func TestClientSync(t *testing.T) {
433436
// This MUST have been called by the time HasSynced returns true
434437
assert.Equal(t, events.Load(), 1)
435438
}
439+
440+
func TestAlternativeVersions(t *testing.T) {
441+
fake := kube.NewFakeClient()
442+
fake.RunAndWait(test.NewStop(t))
443+
vs := apiistioioapinetworkingv1beta1.VirtualService{
444+
TypeMeta: metav1.TypeMeta{},
445+
ObjectMeta: metav1.ObjectMeta{Name: "oo"},
446+
Spec: v1beta1.VirtualService{Hosts: []string{"hello"}},
447+
Status: v1alpha1.IstioStatus{},
448+
}
449+
_, err := fake.Istio().NetworkingV1beta1().VirtualServices("test").Create(context.Background(), &vs, metav1.CreateOptions{})
450+
assert.NoError(t, err)
451+
}

0 commit comments

Comments
 (0)