test(knowledge): unbreak service test package after tag-loading change
Fixing the knowledge_create_test compile error in this branch let the internal/application/service test package run for the first time, which exposed two latent failures introduced when GetKnowledgeByID started eagerly loading tags: - GetOwningKBCreatorID went through the service-level GetKnowledgeByID (which now calls repo.GetKnowledgeTags); ownership resolution only needs the knowledge -> kb_id link, so resolve via repo.GetKnowledgeByID directly (tenant-scoped) and drop the extra tag query. - createKnowledgeFileRepoStub lacked GetKnowledgeTags, which the create path always invokes via setAndAttachKnowledgeTags; add the stub method.
This commit is contained in:
@@ -39,6 +39,15 @@ func (r *createKnowledgeFileRepoStub) CreateKnowledge(ctx context.Context, knowl
|
||||
return r.createErr
|
||||
}
|
||||
|
||||
// GetKnowledgeTags is invoked by setAndAttachKnowledgeTags after create even
|
||||
// when no tags were supplied; a fresh knowledge has none, so return empty.
|
||||
func (r *createKnowledgeFileRepoStub) GetKnowledgeTags(
|
||||
ctx context.Context,
|
||||
knowledgeIDs []string,
|
||||
) (map[string][]*types.KnowledgeTag, error) {
|
||||
return map[string][]*types.KnowledgeTag{}, nil
|
||||
}
|
||||
|
||||
type createKnowledgeFileKBServiceStub struct {
|
||||
interfaces.KnowledgeBaseService
|
||||
|
||||
|
||||
Reference in New Issue
Block a user