mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-08 08:28:02 +08:00
Go: add context to storage (#17690)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -244,7 +244,8 @@ func TestParserComponent_Invoke_ResolvesBinaryFromDocID(t *testing.T) {
|
||||
ms := withMemoryStorage(t)
|
||||
db := withFileComponentTestDB(t)
|
||||
location := "docs/from-parser.txt"
|
||||
if err := ms.Put("kb-parser", location, []byte("alpha\fbeta")); err != nil {
|
||||
ctx := t.Context()
|
||||
if err := ms.Put(ctx, "kb-parser", location, []byte("alpha\fbeta")); err != nil {
|
||||
t.Fatalf("seed storage: %v", err)
|
||||
}
|
||||
docName := "parser.txt"
|
||||
@@ -263,7 +264,7 @@ func TestParserComponent_Invoke_ResolvesBinaryFromDocID(t *testing.T) {
|
||||
}
|
||||
|
||||
c := &ParserComponent{Param: schema.ParserParam{}.Defaults()}
|
||||
out, err := c.Invoke(context.Background(), db, map[string]any{"doc_id": "doc-parser"})
|
||||
out, err := c.Invoke(ctx, db, map[string]any{"doc_id": "doc-parser"})
|
||||
if err != nil {
|
||||
t.Fatalf("Invoke: %v", err)
|
||||
}
|
||||
@@ -281,12 +282,13 @@ func TestParserComponent_Invoke_ResolvesBinaryFromDocID(t *testing.T) {
|
||||
|
||||
func TestParserComponent_Invoke_ResolvesBinaryFromBucketPath(t *testing.T) {
|
||||
ms := withMemoryStorage(t)
|
||||
if err := ms.Put("bucket-1", "docs/explicit.txt", []byte("bucket content")); err != nil {
|
||||
ctx := t.Context()
|
||||
if err := ms.Put(ctx, "bucket-1", "docs/explicit.txt", []byte("bucket content")); err != nil {
|
||||
t.Fatalf("seed storage: %v", err)
|
||||
}
|
||||
|
||||
c := &ParserComponent{Param: schema.ParserParam{}.Defaults()}
|
||||
out, err := c.Invoke(context.Background(), nil, map[string]any{
|
||||
out, err := c.Invoke(ctx, nil, map[string]any{
|
||||
"bucket": "bucket-1",
|
||||
"path": "docs/explicit.txt",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user