Skip to content

Commit 41d9c5c

Browse files
committed
fix ut_test_md
Signed-off-by: sweeywu <sweetwx6@gmail.com>
1 parent ba0fe45 commit 41d9c5c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/proposal/ut_test.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ nitty-gritty.
6767
- Mock Functions: For each _test.c file, include the necessary mocked BPF helper functions required during testing.
6868

6969
- Testing Methods:
70+
7071
- For branches that write to BPF maps, use coll.Maps["..."] on the Go testing side to verify whether the map contents are correct.
7172

7273
### Design Details
@@ -79,7 +80,9 @@ proposal will be implemented, this is the place to discuss them.
7980
-->
8081

8182
### sendmsg.c
83+
8284
### mount and set up
85+
8386
#### mount
8487

8588
- include the sockhash map in workload_sendmsg.c
@@ -95,6 +98,7 @@ struct {
9598
```
9699
97100
- in workload_test.go
101+
98102
- load the eBPF program into the kernel
99103
100104
```go
@@ -195,7 +199,9 @@ struct {
195199
```
196200

197201
### cgroup_sock.c
202+
198203
### mount and set up
204+
199205
#### mount
200206

201207
- in workload_test.go
@@ -223,10 +229,15 @@ defer conn.Close()
223229
### test
224230

225231
- Currently, connect4 and connect6 each have 5 test points.
232+
226233
- 1
234+
227235
- 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+
228237
- 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+
229239
- Validation method:
240+
230241
- Verify the addition when inserting.
231242

232243
```go
@@ -274,10 +285,15 @@ defer conn.Close()
274285
```
275286

276287
- Notes
288+
277289
- 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+
278291
- 2
292+
279293
- The function sock_traffic_control(&kmesh_ctx) is critical and internally includes
294+
280295
- frontend_v = map_lookup_frontend(&frontend_k); Consider how to return frontend_v; this must return a value.
296+
281297
- By constructing a key-value pair so that the map contains this k-v, it can be found; construct the frontend map.
282298

283299
```go
@@ -343,9 +359,13 @@ test:=localIp+":"+strconv.Itoa(htons(55555))
343359
```
344360

345361
- 2.2.2:
362+
346363
- 2.2: If not found, perform kmesh_map_lookup_elem(&map_of_backend, key); this must return a value
364+
347365
- 2.2.1:
366+
348367
- Test point: waypoint == true in backend_value
368+
349369
- Construction:
350370

351371
```go
@@ -380,7 +400,9 @@ _, err = net.Listen("tcp4", testIpPort)
380400
```
381401

382402
- 2.2.2
403+
383404
- Test point: waypoint == false in backend_value
405+
384406
- Construction:
385407

386408
```go

0 commit comments

Comments
 (0)