partial fix on istio

This commit is contained in:
Michel Loiseleur 2023-06-19 10:06:05 +02:00
parent c9cf1e9e1f
commit 4da80b2ffb
2 changed files with 7 additions and 7 deletions

View File

@ -1302,7 +1302,7 @@ type fakeGatewayConfig struct {
} }
func (c fakeGatewayConfig) Config() *networkingv1alpha3.Gateway { func (c fakeGatewayConfig) Config() *networkingv1alpha3.Gateway {
gw := networkingv1alpha3.Gateway{ gw := &networkingv1alpha3.Gateway{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: c.name, Name: c.name,
Namespace: c.namespace, Namespace: c.namespace,
@ -1323,5 +1323,5 @@ func (c fakeGatewayConfig) Config() *networkingv1alpha3.Gateway {
gw.Spec.Servers = servers gw.Spec.Servers = servers
return &gw return gw
} }

View File

@ -46,7 +46,7 @@ type VirtualServiceSuite struct {
suite.Suite suite.Suite
source Source source Source
lbServices []*v1.Service lbServices []*v1.Service
gwconfig networkingv1alpha3.Gateway gwconfig *networkingv1alpha3.Gateway
vsconfig *networkingv1alpha3.VirtualService vsconfig *networkingv1alpha3.VirtualService
} }
@ -75,12 +75,12 @@ func (suite *VirtualServiceSuite) SetupTest() {
suite.NoError(err, "should succeed") suite.NoError(err, "should succeed")
} }
suite.gwconfig = *(fakeGatewayConfig{ suite.gwconfig = (fakeGatewayConfig{
name: "foo-gateway-with-targets", name: "foo-gateway-with-targets",
namespace: "istio-system", namespace: "istio-system",
dnsnames: [][]string{{"*"}}, dnsnames: [][]string{{"*"}},
}).Config() }).Config()
_, err = fakeIstioClient.NetworkingV1alpha3().Gateways(suite.gwconfig.Namespace).Create(context.Background(), &suite.gwconfig, metav1.CreateOptions{}) _, err = fakeIstioClient.NetworkingV1alpha3().Gateways(suite.gwconfig.Namespace).Create(context.Background(), suite.gwconfig, metav1.CreateOptions{})
suite.NoError(err, "should succeed") suite.NoError(err, "should succeed")
suite.vsconfig = (fakeVirtualServiceConfig{ suite.vsconfig = (fakeVirtualServiceConfig{
@ -1585,7 +1585,7 @@ func newTestVirtualServiceSource(loadBalancerList []fakeIngressGatewayService, g
gwObj := gw.Config() gwObj := gw.Config()
// use create instead of add // use create instead of add
// https://github.com/kubernetes/client-go/blob/92512ee2b8cf6696e9909245624175b7f0c971d9/testing/fixture.go#LL336C3-L336C52 // https://github.com/kubernetes/client-go/blob/92512ee2b8cf6696e9909245624175b7f0c971d9/testing/fixture.go#LL336C3-L336C52
_, err := fakeIstioClient.NetworkingV1alpha3().Gateways(gw.namespace).Create(context.Background(), &gwObj, metav1.CreateOptions{}) _, err := fakeIstioClient.NetworkingV1alpha3().Gateways(gw.namespace).Create(context.Background(), gwObj, metav1.CreateOptions{})
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1637,7 +1637,7 @@ func (c fakeVirtualServiceConfig) Config() *networkingv1alpha3.VirtualService {
Namespace: c.namespace, Namespace: c.namespace,
Annotations: c.annotations, Annotations: c.annotations,
}, },
Spec: vs, Spec: *vs.DeepCopy(),
} }
} }