Files
xinmi/internal/application/service/knowledge_post_process_trace_test.go
T
yawan f7fc992f57
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
2026-09-22 16:19:06 +08:00

55 lines
1.9 KiB
Go

package service
import (
"context"
"testing"
"github.com/Tencent/WeKnora/internal/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestFinishRunningMultimodalStage_PreservesSkippedStage(t *testing.T) {
tracker, db := setupSpanTrackerTest(t)
ctx := context.Background()
_, attempt, err := tracker.OpenAttempt(ctx, "kid-multimodal-disabled", "")
require.NoError(t, err)
mm := tracker.BeginStage(ctx, "kid-multimodal-disabled", attempt, types.StageMultimodal, nil)
require.NotNil(t, mm)
tracker.SkipSpan(ctx, mm, "skipped")
service := &KnowledgePostProcessService{spanTracker: tracker}
service.finishRunningMultimodalStage(ctx, "kid-multimodal-disabled", attempt)
var row types.KnowledgeProcessingSpan
require.NoError(t, db.Table("knowledge_processing_spans").
Where("knowledge_id = ? AND attempt = ? AND name = ?",
"kid-multimodal-disabled", attempt, types.StageMultimodal).
First(&row).Error)
assert.Equal(t, types.SpanStatusSkipped, row.Status)
assert.Equal(t, int64(0), row.DurationMs)
}
func TestFinishRunningMultimodalStage_CompletesRunningStage(t *testing.T) {
tracker, db := setupSpanTrackerTest(t)
ctx := context.Background()
_, attempt, err := tracker.OpenAttempt(ctx, "kid-multimodal-enabled", "")
require.NoError(t, err)
mm := tracker.BeginStage(ctx, "kid-multimodal-enabled", attempt, types.StageMultimodal, nil)
require.NotNil(t, mm)
service := &KnowledgePostProcessService{spanTracker: tracker}
service.finishRunningMultimodalStage(ctx, "kid-multimodal-enabled", attempt)
var row types.KnowledgeProcessingSpan
require.NoError(t, db.Table("knowledge_processing_spans").
Where("knowledge_id = ? AND attempt = ? AND name = ?",
"kid-multimodal-enabled", attempt, types.StageMultimodal).
First(&row).Error)
assert.Equal(t, types.SpanStatusDone, row.Status)
assert.NotNil(t, row.FinishedAt)
assert.GreaterOrEqual(t, row.DurationMs, int64(0))
}