项目文件夹

文件
wehub-resource-sync 498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:17 +08:00

61 行
1.2 KiB
Go

package io
import (
"os"
"path"
"testing"
"github.com/samber/lo"
"github.com/stretchr/testify/suite"
"golang.org/x/net/context"
"github.com/milvus-io/milvus/internal/storage"
"github.com/milvus-io/milvus/pkg/v3/objectstorage"
"github.com/milvus-io/milvus/pkg/v3/util/paramtable"
)
var binlogIOTestDir string
func init() {
dir, _ := os.MkdirTemp("", "milvus_test_binlog_io_*")
binlogIOTestDir = dir
}
func TestBinlogIO(t *testing.T) {
suite.Run(t, new(BinlogIOSuite))
}
type BinlogIOSuite struct {
suite.Suite
cm storage.ChunkManager
b BinlogIO
}
func (s *BinlogIOSuite) SetupTest() {
paramtable.Init()
s.cm = storage.NewLocalChunkManager(objectstorage.RootPath(binlogIOTestDir))
s.b = NewBinlogIO(s.cm)
}
func (s *BinlogIOSuite) TeardownTest() {
ctx := context.Background()
s.cm.RemoveWithPrefix(ctx, s.cm.RootPath())
}
func (s *BinlogIOSuite) TestUploadDownload() {
kvs := map[string][]byte{
path.Join(binlogIOTestDir, "a/b/c"): {1, 255, 255},
path.Join(binlogIOTestDir, "a/b/d"): {1, 255, 255},
}
ctx := context.Background()
err := s.b.Upload(ctx, kvs)
s.NoError(err)
vs, err := s.b.Download(ctx, lo.Keys(kvs))
s.NoError(err)
s.ElementsMatch(lo.Values(kvs), vs)
}