Files
singbox_glue/docs/testing.md
T

53 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Тестирование
## Уровни
1. Unit: URI, policy, version, renderer, redaction и metadata.
2. Failure injection: candidate rejection, restart failure, URI/config restore,
unmanaged config, corrupted/legacy last-good.
3. Packaging: MPL-2.0, exact dependency, upgrade rejection и postinst guard.
4. Real binary: официальный sing-box 1.14.0 для Gecko и Salamander configs.
5. Privileged Linux: TUN, systemd, nftables, routing и DNS.
6. HY2XS acceptance: Gecko TCP/UDP/DNS, failures, reconnect и reboot.
## Unit tests
На Linux:
```bash
make check
```
На Windows с isolated Python:
```powershell
E:\python-31312\python.exe -c "import sys,unittest; sys.path[:0]=[r'F:\projects\singbox_glue',r'F:\projects\singbox_glue\src']; s=unittest.defaultTestLoader.discover('tests',top_level_dir='.'); r=unittest.TextTestRunner(verbosity=2).run(s); raise SystemExit(not r.wasSuccessful())"
```
## Real binary
```bash
SING_BOX_1_14_0=/usr/bin/sing-box make test
```
Тест сначала проверяет exact version/tags. На Linux выполняется `check`; на
Windows — schema decoding через `format`, поскольку Windows binary не может
создать Linux auto-redirect.
## Privileged Debian acceptance
В disposable Incus/VM с двумя NIC проверить:
1. чистую установку и отказ in-place upgrade;
2. Gecko config и отсутствие last-good после первого apply;
3. table 2022, rule 9000/32768, marks и NFQUEUE 100;
4. bootstrap DNS через `eth0`, DoH через `hy2-out`;
5. TCP/UDP/DNS с workload за `eth1`;
6. отсутствие прямого WAN при остановленном sing-box;
7. credential failure и same-release rollback;
8. отказ legacy/mismatched metadata;
9. A-record change и reboot recovery.
Server-side Gecko E2E выполняет владелец HY2XS. Salamander проверяется только на
disposable test server и не добавляется в production server configuration.