chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package asynqdl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/hibiken/asynq"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// A panic below RecoverMiddleware reaches the dead-letter callback as an
|
||||
// ordinary error instead of unwinding past it.
|
||||
func TestRecoverMiddleware_PanicReachesDeadLetterCallback(t *testing.T) {
|
||||
repo := &fakeRepo{}
|
||||
var callbackErr error
|
||||
cb := func(_ context.Context, _ *asynq.Task, err error) { callbackErr = err }
|
||||
panicking := asynq.HandlerFunc(func(context.Context, *asynq.Task) error {
|
||||
panic("nil retrieve engine")
|
||||
})
|
||||
h := MiddlewareWithCallback(repo, cb)(RecoverMiddleware()(panicking))
|
||||
|
||||
err := h.ProcessTask(context.Background(), asynq.NewTask("document:process", []byte(`{}`)))
|
||||
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "document:process panicked")
|
||||
assert.Equal(t, err, callbackErr)
|
||||
assert.Equal(t, 1, repo.rowCount())
|
||||
}
|
||||
Reference in new issue
Block a user