Commit Graph
48 Commits
Author SHA1 Message Date
w1ndyb0y 7f65004cd4 test: add missing tests and fix hanging transport test
New test packages:
- config/loader_test.go: 5 tests (valid, minimal, missing file, pulsar-only, defaults)
- serial/serial_test.go: 6 tests (interface, read, EOF, close, empty)
- app/app_test.go: 5 tests (New, dispatch store/send, error handling, ctx cancellation)

Enhanced test packages:
- storage/store_test.go: +3 tests (concurrent insert, close/reopen, init clears)
- telegram/parser_test.go: +5 tests (concurrency, rawLog, empty, multiline, removeEmpty)
- transport/transport_test.go: +7 tests, +fixes

Fixes:
- app.go: store field type *storage.Store -> storage.Repository (supports mocking)
- transport_test: fix net.Pipe() sync deadlock in SetConnClosesPrevious
- transport_test: fix MultiSender_ErrorPropagation expectations

Results: 6 packages, 30+ tests, all pass with -race
2026-07-10 16:05:19 +08:00
w1ndyb0y 86d473c03d clean: remove deprecated utils/ package
- Remove all 5 files from utils/ (serial.go, socket.go, pulsar.go,
  sqlite.go, telegram.go)
- cmd/root.go: remove utils import and all utils. references
- cmd/test.go: rewrite to use serial, storage, transport packages directly
  with proper error logging via zap
2026-07-10 15:41:13 +08:00
w1ndyb0y 419f25f0dd fix: comprehensive bug fixes and architecture restructuring
Phase 1 — Bug fixes (7 bugs):
- Bug 1: Pulsar mode data loss — always persist to SQLite regardless of mode
- Bug 2: PulsarSend closing TCP client — use independent resetPulsarProducer()
- Bug 3: Greedy regex — use non-greedy (?s)ZCZC.*?NNNN
- Bug 4: Data after NNNN discarded — keep remaining buffer data
- Bug 5: strings.Index > 0 boundary — use strings.Contains
- Bug 6: Variable shadowing in PulsarSend — use = not :=
- Bug 7: Accept failure nil panic — add continue + retry logic

Phase 2 — Architecture restructuring:
- Split utils/ into config/, serial/, telegram/, storage/, transport/
- Define Sender, Repository, Reader interfaces
- Introduce app/ layer with context.Context lifecycle
- Replace spinlock with sync.Mutex
- Unified Config struct replaces 15+ global vars

Phase 3 — Testing & tooling:
- telegram/parser_test.go (7 test cases)
- storage/store_test.go (5 test cases)
- transport/transport_test.go (4 test cases)
- Taskfile: add test, test-race, test-cover tasks
- Go version: 1.15 -> 1.21
2026-07-10 15:32:34 +08:00
w1ndyb0y 133c80088c check tcp when insert telegram to db 2021-02-01 17:29:01 +08:00
w1ndyb0y fe1a8169e6 move pulsar send to telegram.go 2021-02-01 17:13:54 +08:00
w1ndyb0y 9ec63dd8b8 create producer 2021-02-01 17:07:52 +08:00
w1ndyb0y b9a826faf8 pulsar write 2021-02-01 17:03:24 +08:00
w1ndyb0y 980c52c940 log message id 2021-02-01 16:09:35 +08:00
w1ndyb0y bd2a379d17 add test 2021-02-01 15:42:46 +08:00
w1ndyb0y 3ad4c76acd add pulsar client 2021-02-01 15:35:13 +08:00
w1ndyb0y 9a14fb2cef update mod 2021-01-25 17:54:13 +08:00
w1ndyb0y 98cf3fa0e3 ignore rawlog error 2020-12-31 10:46:34 +08:00
w1ndyb0y b0836f95b0 remove brace 2020-12-31 10:45:07 +08:00
w1ndyb0y 94cdfe3886 Merge branch 'develop' of gitee.com:w1ndyb0y/tele-recv into develop 2020-12-31 10:28:15 +08:00
w1ndyb0y faa96b03b5 Merge tag 'v0.0.1' into develop
test release plugin
2020-12-23 16:18:54 +08:00
w1ndyb0y 2b2468350b Merge branch 'release/v0.0.1' 2020-12-23 16:18:39 +08:00
w1ndyb0y 8d777b4134 add release to drone 2020-12-23 16:16:28 +08:00
w1ndyb0y 6e9cf592c0 golang build image from alpine to buster 2020-12-23 16:09:16 +08:00
w1ndyb0y 447075fa83 step -> steps 2020-12-23 15:55:33 +08:00
w1ndyb0y fab3a2ad72 drone config error 2020-12-23 15:54:13 +08:00
w1ndyb0y af4e598acc init readme 2020-12-23 15:50:42 +08:00
w1ndyb0y 5d83a44a07 add drone config 2020-12-23 15:47:36 +08:00
w1ndyb0y 2900409465 client close 2020-12-23 14:39:57 +08:00
w1ndyb0y 8763ae6c08 update result 2020-12-23 14:31:25 +08:00
w1ndyb0y bac084b1d0 add client ready flag 2020-12-23 14:30:09 +08:00
w1ndyb0y 7a21e09048 rewrite load 2020-12-23 14:23:55 +08:00
w1ndyb0y 33eab0a6c6 check statement error 2020-12-23 14:12:00 +08:00
w1ndyb0y 18ff12f424 add transaction in write 2020-12-23 14:04:06 +08:00
w1ndyb0y 216e92f983 add lock log 2020-12-23 13:49:46 +08:00
w1ndyb0y 514e01b31c Merge branch 'develop' of gitee.com:w1ndyb0y/tele-recv into develop 2020-12-23 13:45:23 +08:00
w1ndyb0y 97a7cf1d07 get db remove init log 2020-12-23 13:45:00 +08:00
w1ndyb0y 0df588f587 add load unprocessed 2020-12-23 13:07:45 +08:00
w1ndyb0y 9897c1dc82 Merge branch 'develop' of gitee.com:w1ndyb0y/tele-recv into develop
 Conflicts:
	cmd/start.go
2020-12-23 11:13:36 +08:00
w1ndyb0y fd219b1a13 running status 2020-12-23 11:13:14 +08:00
w1ndyb0y 594f1e6778 add telegram insert 2020-12-21 17:59:37 +08:00
w1ndyb0y 6210287123 add socket server 2020-12-21 17:59:15 +08:00
w1ndyb0y f67d00d6b8 add insert new telegram 2020-12-21 17:58:55 +08:00
w1ndyb0y 540e682c0b add socket 2020-12-21 17:58:30 +08:00
w1ndyb0y 5fb48afd7b remove start tag 2020-12-21 16:21:43 +08:00
w1ndyb0y 92a10cd4e6 add lograw option 2020-12-21 16:18:22 +08:00
w1ndyb0y 481870cea9 check telegram string 2020-12-21 16:18:08 +08:00
w1ndyb0y 8a116818cf move to utils package 2020-12-21 15:38:33 +08:00
w1ndyb0y 51fa99e57b add git toolbox 2020-12-21 14:07:59 +08:00
w1ndyb0y cd302234af create test function 2020-12-21 11:42:36 +08:00
w1ndyb0y 8e417699c0 add test db 2020-12-21 11:36:08 +08:00
w1ndyb0y 787a949428 add git ignore file 2020-12-21 11:35:47 +08:00
w1ndyb0y 2a6f8c594b git flow init 2020-12-21 11:22:03 +08:00
w1ndyb0y 5d0e0df125 init 2020-12-21 11:19:53 +08:00