You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/proposal/ut_test.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,7 @@ nitty-gritty.
67
67
- Mock Functions: For each _test.c file, include the necessary mocked BPF helper functions required during testing.
68
68
69
69
- Testing Methods:
70
+
70
71
- For branches that write to BPF maps, use coll.Maps["..."] on the Go testing side to verify whether the map contents are correct.
71
72
72
73
### Design Details
@@ -79,7 +80,9 @@ proposal will be implemented, this is the place to discuss them.
79
80
-->
80
81
81
82
### sendmsg.c
83
+
82
84
### mount and set up
85
+
83
86
#### mount
84
87
85
88
- include the sockhash map in workload_sendmsg.c
@@ -95,6 +98,7 @@ struct {
95
98
```
96
99
97
100
- in workload_test.go
101
+
98
102
- load the eBPF program into the kernel
99
103
100
104
```go
@@ -195,7 +199,9 @@ struct {
195
199
```
196
200
197
201
### cgroup_sock.c
202
+
198
203
### mount and set up
204
+
199
205
#### mount
200
206
201
207
- in workload_test.go
@@ -223,10 +229,15 @@ defer conn.Close()
223
229
### test
224
230
225
231
- Currently, connect4 and connect6 each have 5 test points.
232
+
226
233
- 1
234
+
227
235
- handle_kmesh_manage_process(&kmesh_ctx) internally calls bpf_map_update_elem(&map_of_manager, &key, &value, BPF_ANY); or err = bpf_map_delete_elem(&map_of_manager, &key); for verification.
236
+
228
237
- When the destination address is CONTROL_CMD_IP: ENABLE_KMESH_PORT, it adds its netns_cookie to the map; when the destination address is CONTROL_CMD_IP: DISABLE_KMESH_PORT, it deletes its netns_cookie from the map.
238
+
229
239
- Validation method:
240
+
230
241
- Verify the addition when inserting.
231
242
232
243
```go
@@ -274,10 +285,15 @@ defer conn.Close()
274
285
```
275
286
276
287
- Notes
288
+
277
289
- Here it may be necessary to mock storage = bpf_sk_storage_get(&map_of_sock_storage, sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); inside workload_cgroup_sock_test.c.
290
+
278
291
- 2
292
+
279
293
- The function sock_traffic_control(&kmesh_ctx) is critical and internally includes
294
+
280
295
- frontend_v = map_lookup_frontend(&frontend_k); Consider how to return frontend_v; this must return a value.
296
+
281
297
- By constructing a key-value pair so that the map contains this k-v, it can be found; construct the frontend map.
0 commit comments