mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
s3vectors.index.metadata -bucket b -index i [-add key | -remove key] prints each indexed metadata key with its state, the share of rows its scalar index covers, its segments and size. The shell's in-process S3 Vectors server setup moves into shellVectorsServer for both commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011UpvafvK8JpagF94MHWqwK
29 lines
890 B
Go
29 lines
890 B
Go
package command
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/vector_pb"
|
|
)
|
|
|
|
func TestPrintMetadataKeys(t *testing.T) {
|
|
var out bytes.Buffer
|
|
if err := printMetadataKeys(&out, &vector_pb.MetadataKeysResponse{Keys: []*vector_pb.MetadataKey{
|
|
{Key: "lang", State: "requested", Rows: 10},
|
|
{Key: "author", State: "ready", Column: "_mk_0", IndexedRows: 75, Rows: 100, Segments: 2, IndexBytes: 3 << 20},
|
|
}}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
lines := strings.Split(strings.TrimSpace(out.String()), "\n")
|
|
if len(lines) != 3 || !strings.Contains(lines[1], "requested") || !strings.Contains(lines[2], "75%") || !strings.Contains(lines[2], "3.0 MiB") {
|
|
t.Fatalf("%q", out.String())
|
|
}
|
|
out.Reset()
|
|
_ = printMetadataKeys(&out, &vector_pb.MetadataKeysResponse{})
|
|
if !strings.Contains(out.String(), "no indexed metadata keys") {
|
|
t.Fatal(out.String())
|
|
}
|
|
}
|