Skip to content

Commit b67b286

Browse files
committed
pass ut
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
1 parent 970c95b commit b67b286

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

config/kmesh_marcos_def.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* and sidecar containers. The bpf_sk_original_addr auxiliary function is
1515
* used to obtain the original destination address.
1616
*/
17-
#define MDA_NAT_ACCEL 1
17+
#define MDA_NAT_ACCEL 0
1818

1919
/* supports acceleration function filtering based on GID and UID.
2020
* That is, the GID or UID corresponding to the process to be accelerated
2121
* is configured in the configuration file. The bpf_get_sockops_uid_gid
2222
* auxiliary function is used to obtain the GID and UID of the current
2323
* process.
2424
*/
25-
#define MDA_GID_UID_FILTER 1
25+
#define MDA_GID_UID_FILTER 0
2626

2727
/*
2828
* openEuler-23.03 is an innovative version of openEuler, in the early time, we
@@ -50,7 +50,7 @@
5050
* in kernel 6.x version, add the new iter type ITER_UBUF, and we need add code
5151
* for the corresponding scenarios.
5252
*/
53-
#define ITER_TYPE_IS_UBUF 0
53+
#define ITER_TYPE_IS_UBUF 1
5454

5555
/*
5656
* Kmesh’s Layer 7 acceleration proxy capability relies on kernel enhancements.
@@ -67,4 +67,4 @@
6767
* the libbpf version in the current environment, and the code in the project
6868
* is enabled accordingly.
6969
* */
70-
#define LIBBPF_HIGHER_0_6_0_VERSION 0
70+
#define LIBBPF_HIGHER_0_6_0_VERSION 1

config/linux-bpf.h

Whitespace-only changes.

mk/api-v2-c.pc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
prefix=
1+
prefix=/kmesh/
22

33
Name: api-v2-c
44
Description: api-v2-c

mk/bpf.pc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
prefix=
1+
prefix=/kmesh/
22
Name: bpf
33
Description: bpf
44
Version:

pkg/controller/workload/cache/waypoint_cache.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ func (w *waypointCache) DeleteService(resourceName string) {
139139
// This service has waypoint.
140140
if waypoint, ok := w.serviceToWaypoint[resourceName]; ok {
141141
delete(w.serviceToWaypoint, resourceName)
142-
w.waypointAssociatedObjects[waypoint].deleteService(resourceName)
142+
if associate, ok := w.waypointAssociatedObjects[waypoint]; ok {
143+
associate.deleteService(resourceName)
144+
}
143145
}
144146

145147
// This may be a waypoint service.
@@ -205,7 +207,9 @@ func (w *waypointCache) DeleteWorkload(uid string) {
205207

206208
if waypoint, ok := w.workloadToWaypoint[uid]; ok {
207209
delete(w.workloadToWaypoint, uid)
208-
w.waypointAssociatedObjects[waypoint].deleteWorkload(uid)
210+
if associated, ok := w.waypointAssociatedObjects[waypoint]; ok {
211+
associated.deleteWorkload(uid)
212+
}
209213
}
210214
}
211215

pkg/controller/workload/cache/waypoint_cache_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func TestBasic(t *testing.T) {
9898
assert.Equal(t, isHostnameTypeWaypoint(associated.workloads[wl4.ResourceName()].Waypoint), false)
9999

100100
// Delete all svcs and workloads.
101-
for _, svc := range []*workloadapi.Service{svc1, svc2, svc3, svc4} {
101+
for _, svc := range []*workloadapi.Service{svc1, svc2, svc3, svc4, waypointsvc} {
102102
cache.DeleteService(svc.ResourceName())
103103
}
104104
for _, wl := range []*workloadapi.Workload{wl1, wl2, wl3, wl4} {
@@ -107,6 +107,7 @@ func TestBasic(t *testing.T) {
107107

108108
assert.Equal(t, len(cache.serviceToWaypoint), 0)
109109
assert.Equal(t, len(cache.workloadToWaypoint), 0)
110+
assert.Equal(t, len(cache.waypointAssociatedObjects), 0)
110111
}
111112

112113
// NOTE: All utility functions are simplified for the waypoint cache related tests and omit irrelevant fields.

0 commit comments

Comments
 (0)