@@ -3,6 +3,8 @@ package meshservice
33import (
44 "fmt"
55
6+ core_meta "github.com/kumahq/kuma/v2/pkg/core/metadata"
7+ "github.com/kumahq/kuma/v2/pkg/test/resources/builders"
68 . "github.com/onsi/ginkgo/v2"
79 . "github.com/onsi/gomega"
810 "golang.org/x/sync/errgroup"
@@ -19,95 +21,50 @@ import (
1921func Sync () {
2022 meshName := "meshservice"
2123 namespace := "meshservice"
22-
24+ meshMultiZone := builders .MeshMultiZoneService ().
25+ WithName ("backend" ).
26+ WithMesh (meshName ).
27+ WithLabels (map [string ]string {"test-name" : "mssync" }).
28+ WithServiceLabelSelector (map [string ]string {"test-name" : "backend" }).
29+ AddIntPortWithName (80 , core_meta .ProtocolHTTP , "80" ).Build ()
2330 BeforeAll (func () {
2431 Expect (NewClusterSetup ().
2532 Install (MTLSMeshUniversal (meshName )).
2633 Install (MeshTrafficPermissionAllowAllUniversal (meshName )).
27- Install (YamlUniversal (`
28- type: MeshMultiZoneService
29- name: backend
30- mesh: meshservice
31- labels:
32- test-name: mssync
33- spec:
34- selector:
35- meshService:
36- matchLabels:
37- test-name: backend
38- ports:
39- - port: 80
40- appProtocol: http
41- ` )).
34+ Install (ResourceUniversal (meshMultiZone )).
4235 Setup (multizone .Global )).To (Succeed ())
4336 Expect (WaitForMesh (meshName , multizone .Zones ())).To (Succeed ())
4437
4538 group := errgroup.Group {}
46-
39+ meshService := builders .MeshService ().
40+ WithName ("backend" ).
41+ WithMesh (meshName ).
42+ WithLabels (map [string ]string {"test-name" : "backend" , "kuma.io/origin" : "zone" }).
43+ WithDataplaneTagsSelector (map [string ]string {"kuma.io/service" : "test-server" }).
44+ AddIntPortWithName (80 , 80 , core_meta .ProtocolHTTP , "80" ).
45+ Build ()
4746 NewClusterSetup ().
48- Install (YamlUniversal (`
49- type: MeshService
50- name: backend
51- mesh: meshservice
52- labels:
53- kuma.io/origin: zone
54- test-name: backend
55- spec:
56- selector:
57- dataplaneTags:
58- kuma.io/service: test-server
59- ports:
60- - port: 80
61- targetPort: 80
62- appProtocol: http
63- ` )).
47+ Install (ResourceUniversal (meshService )).
6448 Install (TestServerUniversal ("dp-echo-1" , meshName ,
6549 WithArgs ([]string {"echo" , "--instance" , "echo-v1" }),
6650 WithServiceVersion ("v1" ),
6751 )).
6852 SetupInGroup (multizone .UniZone1 , & group )
6953
7054 NewClusterSetup ().
71- Install (YamlUniversal (`
72- type: MeshService
73- name: backend
74- mesh: meshservice
75- labels:
76- kuma.io/origin: zone
77- test-name: backend
78- spec:
79- selector:
80- dataplaneTags:
81- kuma.io/service: test-server
82- ports:
83- - port: 80
84- targetPort: 80
85- appProtocol: http
86- ` )).
55+ Install (ResourceUniversal (meshService )).
8756 Install (DemoClientUniversal ("uni-demo-client" , meshName , WithTransparentProxy (true ))).
8857 SetupInGroup (multizone .UniZone2 , & group )
89-
90- veryLongNamedService := `
91- kind: MeshService
92- apiVersion: kuma.io/v1alpha1
93- metadata:
94- name: this-service-has-a-name-thats-the-exact-length-allowed-for-svcs
95- namespace: meshservice
96- labels:
97- kuma.io/mesh: meshservice
98- spec:
99- selector:
100- dataplaneTags:
101- kuma.io/service: some-service
102- ports:
103- - port: 80
104- targetPort: 80
105- appProtocol: http
106- `
58+ veryLongNamedService := builders .MeshService ().
59+ WithName ("this-service-has-a-name-thats-the-exact-length-allowed-for-svcs" ).
60+ WithLabels (map [string ]string {"kuma.io/mesh" : "meshservice" }).
61+ WithDataplaneTagsSelector (map [string ]string {"kuma.io/service" : "some-service" }).
62+ AddIntPortWithName (80 , 80 , core_meta .ProtocolHTTP , "80" ).
63+ Build ()
10764
10865 NewClusterSetup ().
10966 Install (NamespaceWithSidecarInjection (namespace )).
110- Install (YamlK8s (veryLongNamedService )).
67+ Install (ResourceUniversal (veryLongNamedService )).
11168 Install (democlient .Install (democlient .WithNamespace (namespace ), democlient .WithMesh (meshName ))).
11269 SetupInGroup (multizone .KubeZone2 , & group )
11370
0 commit comments