WeKnora/internal/container/datasource_registry_test.go

40 lines
1.1 KiB
Go
Raw Normal View History

package container
import (
"testing"
feat(datasource): add Seafile data source connector (#3616) * fix(datasource): omit last_sync_cursor from the data source list response The settings page polls GET /datasource every few seconds during a sync, and connector cursors can grow to megabytes. No list consumer reads the cursor, so NewDataSourceResponses now blanks it; detail, create and update responses still return it through NewDataSourceResponse. * feat(datasource): add Seafile connector with fingerprint-based incremental sync Sync folders and files from one Seafile library per data source. The connector walks the selected scope one directory level at a time, downloads files through the link + fileserver flow without credentials, and reconciles deletions against a per-file oid/mtime/size fingerprint cursor that is checkpointed every 50 mutations. - resource ids are "<repo_id>:<path>"; ancestors collapse, one library - per-file failures become coded error items and keep the path pending - directory failures and Retry-After > 60s abort without deletions - forced full runs keep the old cursor as a deletion baseline - API token never reaches cursors, metadata, logs or error text - share the supported import extension set through internal/utils * feat(datasource): add Seafile frontend connector and docs Wire the Seafile data source into the editor dialog, channel labels and the five locales, and document how to connect a Seafile 10.0.1 library. - connector definition with base_url + API token fields and icon - picker guard: one library per data source, at least one selection - "library" resource type and icon in the lazy tree - channel label in the knowledge base filter, document views and chat - i18n for labels, guide steps and the eight seafile_* sync error codes - website-docs integration guide, data source and extension point doc updates, and Seafile in the README data source lists --------- Co-authored-by: zaqqmm <q-zhang10@qq.com>
2026-10-08 08:18:09 +00:00
"github.com/Tencent/WeKnora/internal/datasource"
"github.com/Tencent/WeKnora/internal/types"
)
func TestConnectorRegistryIncludesDingTalk(t *testing.T) {
registry, err := initConnectorRegistry()
if err != nil {
t.Fatalf("initConnectorRegistry() error = %v", err)
}
connector, err := registry.Get(types.ConnectorTypeDingTalk)
if err != nil {
t.Fatalf("DingTalk connector is not registered: %v", err)
}
if connector.Type() != types.ConnectorTypeDingTalk {
t.Fatalf("connector.Type() = %q", connector.Type())
}
}
feat(datasource): add Seafile data source connector (#3616) * fix(datasource): omit last_sync_cursor from the data source list response The settings page polls GET /datasource every few seconds during a sync, and connector cursors can grow to megabytes. No list consumer reads the cursor, so NewDataSourceResponses now blanks it; detail, create and update responses still return it through NewDataSourceResponse. * feat(datasource): add Seafile connector with fingerprint-based incremental sync Sync folders and files from one Seafile library per data source. The connector walks the selected scope one directory level at a time, downloads files through the link + fileserver flow without credentials, and reconciles deletions against a per-file oid/mtime/size fingerprint cursor that is checkpointed every 50 mutations. - resource ids are "<repo_id>:<path>"; ancestors collapse, one library - per-file failures become coded error items and keep the path pending - directory failures and Retry-After > 60s abort without deletions - forced full runs keep the old cursor as a deletion baseline - API token never reaches cursors, metadata, logs or error text - share the supported import extension set through internal/utils * feat(datasource): add Seafile frontend connector and docs Wire the Seafile data source into the editor dialog, channel labels and the five locales, and document how to connect a Seafile 10.0.1 library. - connector definition with base_url + API token fields and icon - picker guard: one library per data source, at least one selection - "library" resource type and icon in the lazy tree - channel label in the knowledge base filter, document views and chat - i18n for labels, guide steps and the eight seafile_* sync error codes - website-docs integration guide, data source and extension point doc updates, and Seafile in the README data source lists --------- Co-authored-by: zaqqmm <q-zhang10@qq.com>
2026-10-08 08:18:09 +00:00
func TestConnectorRegistryIncludesSeafile(t *testing.T) {
registry, err := initConnectorRegistry()
if err != nil {
t.Fatalf("initConnectorRegistry() error = %v", err)
}
connector, err := registry.Get(types.ConnectorTypeSeafile)
if err != nil {
t.Fatalf("Seafile connector is not registered: %v", err)
}
if connector.Type() != types.ConnectorTypeSeafile {
t.Fatalf("connector.Type() = %q", connector.Type())
}
if _, ok := connector.(datasource.FullStreamingConnector); !ok {
t.Fatal("Seafile connector must implement datasource.FullStreamingConnector")
}
}