mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 05:56:38 +08:00
63a24da9ee
Result: {"status":"keep","total_issues":8,"golint_canonicalheader":0,"golint_errname":0,"golint_errorlint":1,"golint_forcetypeassert":0,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":0,"golint_recvcheck":1,"golint_usestdlibvars":0,"golint_wastedassign":0,"golint_total":8,"golint_test_testifylint":0,"golint_test_thelper":0,"golint_test_usetesting":0,"golint_test_total":0,"eslint_problems":0,"eslint_errors":0,"eslint_warnings":0,"tsc_errors":0,"measure_s":39}
28 lines
703 B
Go
28 lines
703 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package task
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hibiken/asynq"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPermanentErrorSkipsRetryWithoutExposingAsynqMessage(t *testing.T) {
|
|
err := PermanentError(" 来源配置无效 ")
|
|
|
|
require.ErrorIs(t, err, asynq.SkipRetry)
|
|
assert.Equal(t, "来源配置无效", err.Error())
|
|
assert.NotContains(t, err.Error(), asynq.SkipRetry.Error())
|
|
}
|
|
|
|
func TestPermanentErrorUsesSafeFallbackForBlankMessage(t *testing.T) {
|
|
err := PermanentError(" ")
|
|
|
|
require.ErrorIs(t, err, asynq.SkipRetry)
|
|
require.Equal(t, defaultPermanentErrorMessage, err.Error())
|
|
}
|