5732bf3384
iotlcm-bot:独立飞书应用机器人(读取 Worker 终态 Run JSON,渲染并发送全量同步结果卡片)。
- Go module:git.5iot.com/iotlcm/iotlcm-bot → git.5iot.com/iotlcm-public/iotlcm-bot
- 飞书凭据占位:appId/appSecret/chatId → ${FEISHU_APP_ID}/${FEISHU_APP_SECRET}/${FEISHU_CHAT_ID}
- 移除内部资产:CI 触发器
- Dockerfile 改用公共基础镜像(golang:1.25-alpine → scratch)
- README 重写(命令/配置/挂载契约/常见问题),去掉内部环境路径
- 补 Apache-2.0 LICENSE,LF 行尾 + .gitattributes
32 lines
550 B
Go
32 lines
550 B
Go
package state
|
|
|
|
import "testing"
|
|
|
|
func TestPrepareCreatesWritableSentDirectory(t *testing.T) {
|
|
s := New(t.TempDir())
|
|
if err := s.Prepare(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestMarkIsIdempotentForLookup(t *testing.T) {
|
|
s := New(t.TempDir())
|
|
sent, err := s.Has("run-1")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if sent {
|
|
t.Fatal("run should not be marked before send")
|
|
}
|
|
if err := s.Mark("run-1"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
sent, err = s.Has("run-1")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !sent {
|
|
t.Fatal("run should be marked")
|
|
}
|
|
}
|