mirror of
https://github.com/milvus-io/milvus.git
synced 2026-07-21 10:15:43 +00:00
build(deps): upgrade go toolchain to 1.26.4 (#48803)
## Summary - Bump **Go to 1.26.4** across CI workflows, Docker builders, RPM setup, and the `go` directive in all 4 modules (+ examples). - Refresh Go 1.26-compatible deps to latest: `sonic` v1.15.2, `mockey` v1.4.6, `gopkg` v0.1.4, `sonic/loader` v0.5.1, `cpuid/v2` v2.3.0. sonic 1.14.x fails to build on the 1.26 compiler (bytedance/sonic#895). - **datacoord tests:** replace the anonymous `struct{ Iface }` mockey idiom with **named helper types** (`embeddedHandler`/`embeddedBroadcastAPI`/`embeddedBroker`/`embeddedAllocator`). ## Why the datacoord test change Go 1.26's `printf` vet pass (run automatically by `go test`) calls `x/tools/refactor/satisfy.Finder` unconditionally and **panics `(*ast.StructType)`** on a **method expression of `*struct{ Iface }`** — an upstream Go toolchain bug. Only `internal/datacoord` used this mockey idiom (31 sites in 2 test files; verified repo-wide it's the only place), which is why only `build-ut-cov`/`ut-go` failed on `internal/datacoord [build failed]`. Switching to a **named type** makes the method-expression receiver an identifier instead of a struct literal, so `satisfy.Finder` no longer panics. mockey usage and test behavior are unchanged. Minimal repro: `type I interface{ Logf(string, ...any) }` + `var _ = (*struct{ I }).Logf` under `go 1.26` → `go vet` panics; named type does not. ## Notes - `.env` builder-image tag intentionally not hand-edited (auto-bumped post-merge by `bump-builder-version`). - The bug also warrants an upstream report to golang/go (reproducer above). ## Test plan - [x] `go mod tidy` clean across all four modules - [x] sonic 1.15.2 + mockey compile on go 1.26.4 - [x] reproduced the vet panic; verified named-type method expression avoids it; gofmt-clean - [ ] Full CI (build / build-ut-cov / ut-go / ut-cpp / integration) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: xiaofanluan <xiaofan.luan@zilliz.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,11 +5,11 @@ IMAGE_ARCH=amd64
|
||||
OS_NAME=ubuntu22.04
|
||||
|
||||
# for services.builder.image in docker-compose.yml
|
||||
DATE_VERSION=20260604-a4e4949
|
||||
LATEST_DATE_VERSION=20260604-a4e4949
|
||||
DATE_VERSION=20260610-5cdf891
|
||||
LATEST_DATE_VERSION=20260610-5cdf891
|
||||
# for services.gpubuilder.image in docker-compose.yml
|
||||
GPU_DATE_VERSION=20260604-a4e4949
|
||||
LATEST_GPU_DATE_VERSION=20260604-a4e4949
|
||||
GPU_DATE_VERSION=20260610-5cdf891
|
||||
LATEST_GPU_DATE_VERSION=20260610-5cdf891
|
||||
|
||||
# for other services in docker-compose.yml
|
||||
MINIO_ADDRESS=minio:9000
|
||||
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.25.8'
|
||||
go-version: '1.26.4'
|
||||
cache: false
|
||||
- name: Download Caches
|
||||
uses: ./.github/actions/macos-cache-restore
|
||||
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
working-directory: build/docker/krte
|
||||
run: |
|
||||
export TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
|
||||
docker build --build-arg IMAGE_ARG="milvusdb/krte:$TAG" --build-arg GO_VERSION=1.15.8 -t "milvusdb/krte:$TAG" .
|
||||
docker build --build-arg IMAGE_ARG="milvusdb/krte:$TAG" --build-arg GO_VERSION=1.26.4 -t "milvusdb/krte:$TAG" .
|
||||
- name: Docker Push
|
||||
if: success() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' )&& github.repository == 'milvus-io/milvus'
|
||||
continue-on-error: true
|
||||
|
||||
@@ -22,7 +22,7 @@ ENV GOPATH /go
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GO111MODULE on
|
||||
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
go clean --modcache && \
|
||||
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)
|
||||
|
||||
@@ -28,7 +28,7 @@ ENV GOPATH /go
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GO111MODULE on
|
||||
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
go clean --modcache && \
|
||||
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)
|
||||
|
||||
@@ -42,7 +42,7 @@ ENV GOPATH /go
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GO111MODULE on
|
||||
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
go clean --modcache && \
|
||||
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)
|
||||
|
||||
@@ -39,7 +39,7 @@ ENV GOPATH /go
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GO111MODULE on
|
||||
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
go clean --modcache && \
|
||||
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)
|
||||
|
||||
@@ -35,7 +35,7 @@ ENV GOPATH /go
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GO111MODULE on
|
||||
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
go clean --modcache && \
|
||||
chmod -R 777 "$GOPATH" && chmod -R a+w $(go env GOTOOLDIR)
|
||||
|
||||
@@ -44,7 +44,7 @@ ENV GOPATH /go
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GO111MODULE on
|
||||
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOROOT}/bin v2.11.3 && \
|
||||
# export GO111MODULE=on && go get github.com/quasilyte/go-ruleguard/cmd/ruleguard@v0.2.1 && \
|
||||
|
||||
@@ -16,7 +16,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-ce
|
||||
|
||||
|
||||
# Install go
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.25.10.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go
|
||||
RUN mkdir -p /usr/local/go && wget -qO- "https://go.dev/dl/go1.26.4.linux-$TARGETARCH.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go
|
||||
# Install conan
|
||||
RUN pip3 install conan==2.25.1
|
||||
# Install rust
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
FROM golang:1.21.11-alpine3.19
|
||||
FROM golang:1.26.4-alpine3.22
|
||||
RUN apk add --no-cache make bash
|
||||
@@ -40,7 +40,7 @@ export GOPATH="/go"
|
||||
export GOROOT="/usr/local/go"
|
||||
export GO111MODULE="on"
|
||||
export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"
|
||||
mkdir -p /usr/local/go && wget -qO- "https://golang.org/dl/go1.15.2.linux-amd64.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p /usr/local/go && wget -qO- "https://golang.org/dl/go1.26.4.linux-amd64.tar.gz" | tar --strip-components=1 -xz -C /usr/local/go && \
|
||||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GOPATH}/bin v1.43.0 && \
|
||||
export GO111MODULE=on && go get github.com/quasilyte/go-ruleguard/cmd/ruleguard@v0.2.1 && \
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
module github.com/milvus-io/milvus/client/v2
|
||||
|
||||
go 1.25.10
|
||||
go 1.26.4
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
module github.com/milvus-io/milvus/examples/telemetry_demo
|
||||
|
||||
go 1.25.8
|
||||
|
||||
toolchain go1.25.8
|
||||
go 1.26.4
|
||||
|
||||
require github.com/milvus-io/milvus/client/v2 v2.6.4-0.20251104142533-a2ce70d25256
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module github.com/milvus-io/milvus/examples/telemetry_e2e_test
|
||||
go 1.25.8
|
||||
go 1.26.4
|
||||
|
||||
require (
|
||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.6-0.20260304062516-e7e54d966ef2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/milvus-io/milvus
|
||||
|
||||
go 1.25.10
|
||||
go 1.26.4
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1
|
||||
@@ -60,8 +60,8 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.62
|
||||
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.23.0
|
||||
github.com/bits-and-blooms/bitset v1.12.0
|
||||
github.com/bytedance/mockey v1.4.4
|
||||
github.com/bytedance/sonic v1.14.0
|
||||
github.com/bytedance/mockey v1.4.6
|
||||
github.com/bytedance/sonic v1.15.2
|
||||
github.com/cenkalti/backoff/v4 v4.2.1
|
||||
github.com/cockroachdb/redact v1.1.3
|
||||
github.com/google/uuid v1.6.0
|
||||
@@ -69,6 +69,7 @@ require (
|
||||
github.com/hamba/avro/v2 v2.29.0
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7
|
||||
github.com/magiconair/properties v1.8.7
|
||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.18
|
||||
github.com/milvus-io/milvus-proto/go-api/v3 v3.0.0-20260526093827-489331a5a41f
|
||||
github.com/milvus-io/milvus/client/v2 v2.6.2
|
||||
github.com/milvus-io/milvus/pkg/v3 v3.0.0-beta
|
||||
@@ -86,6 +87,7 @@ require (
|
||||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring/v2 v2.8.0 // indirect
|
||||
github.com/bytedance/gopkg v0.1.4 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/gopherjs/gopherjs v1.12.80 // indirect
|
||||
@@ -135,7 +137,7 @@ require (
|
||||
github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
|
||||
github.com/bytedance/sonic/loader v0.3.0 // indirect
|
||||
github.com/bytedance/sonic/loader v0.5.1 // indirect
|
||||
github.com/campoy/embedmd v1.0.0 // indirect
|
||||
github.com/casbin/govaluate v1.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
|
||||
@@ -202,12 +202,14 @@ github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwN
|
||||
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
|
||||
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/bytedance/mockey v1.4.4 h1:tRLGNutqx/xJ2D1K6qDkVQXpqNCPMFdq2ozGguVA+Yc=
|
||||
github.com/bytedance/mockey v1.4.4/go.mod h1:1BPHF9sol5R1ud/+0VEHGQq/+i2lN+GTsr3O2Q9IENY=
|
||||
github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ=
|
||||
github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA=
|
||||
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
|
||||
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||
github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
|
||||
github.com/bytedance/gopkg v0.1.4/go.mod h1:v1zWfPm21Fb+OsyXN2VAHdL6TBb2L88anLQgdyje6R4=
|
||||
github.com/bytedance/mockey v1.4.6 h1:pPkAFB6yiaaybvgp7DP1Rj4Ztiew3nsaMizoNkzsvNA=
|
||||
github.com/bytedance/mockey v1.4.6/go.mod h1:1BPHF9sol5R1ud/+0VEHGQq/+i2lN+GTsr3O2Q9IENY=
|
||||
github.com/bytedance/sonic v1.15.2 h1:90H+rcF/FwLXwfB1cudOLq/je83n683Utf4Cbp0xHCo=
|
||||
github.com/bytedance/sonic v1.15.2/go.mod h1:mT2NbXunuaEbnZ+mRIX/vYqKISmgEuHFDI4UzmKx2SA=
|
||||
github.com/bytedance/sonic/loader v0.5.1 h1:Ygpfa9zwRCCKSlrp5bBP/b/Xzc3VxsAW+5NIYXrOOpI=
|
||||
github.com/bytedance/sonic/loader v0.5.1/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
|
||||
github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY=
|
||||
github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8=
|
||||
github.com/casbin/casbin/v2 v2.0.0/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||
@@ -793,6 +795,8 @@ github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6 h1:YHMFI6L
|
||||
github.com/milvus-io/cgosymbolizer v0.0.0-20250318084424-114f4050c3a6/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg=
|
||||
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b h1:TfeY0NxYxZzUfIfYe5qYDBzt4ZYRqzUjTR6CvUzjat8=
|
||||
github.com/milvus-io/gorocksdb v0.0.0-20220624081344-8c5f4212846b/go.mod h1:iwW+9cWfIzzDseEBCCeDSN5SD16Tidvy8cwQ7ZY8Qj4=
|
||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.18 h1:4EaGTuDn0yv9BtQ23l2Wube7d8XcLA4+z2sQsgRkYK0=
|
||||
github.com/milvus-io/milvus-proto/go-api/v2 v2.6.18/go.mod h1:/6UT4zZl6awVeXLeE7UGDWZvXj3IWkRsh3mqsn0DiAs=
|
||||
github.com/milvus-io/milvus-proto/go-api/v3 v3.0.0-20260526093827-489331a5a41f h1:W+paUzc+AA381Rydx2DJffoQuM4l+efVqO+2i9GdfMw=
|
||||
github.com/milvus-io/milvus-proto/go-api/v3 v3.0.0-20260526093827-489331a5a41f/go.mod h1:rbKpv5JToISTKTTLl0duL5r6wbYnjJ9SsD0QgXMzKy0=
|
||||
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs=
|
||||
@@ -1057,9 +1061,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
|
||||
@@ -1272,8 +1272,8 @@ func TestAssembleCopySegmentRequest_AllocatesTextAndJsonBuildIDs(t *testing.T) {
|
||||
|
||||
// Mock allocator to return sequential IDs starting from 9001
|
||||
nextID := int64(9001)
|
||||
alloc := &struct{ allocator.Allocator }{}
|
||||
mock2 := mockey.Mock((*struct{ allocator.Allocator }).AllocID).To(func(ctx context.Context) (typeutil.UniqueID, error) {
|
||||
alloc := &embeddedAllocator{}
|
||||
mock2 := mockey.Mock((*embeddedAllocator).AllocID).To(func(ctx context.Context) (typeutil.UniqueID, error) {
|
||||
id := nextID
|
||||
nextID++
|
||||
return id, nil
|
||||
@@ -1331,3 +1331,7 @@ func TestAssembleCopySegmentRequest_AllocatesTextAndJsonBuildIDs(t *testing.T) {
|
||||
seenIDs[newID] = true
|
||||
}
|
||||
}
|
||||
|
||||
// embeddedAllocator: named type for mockey interface-method patching; avoids a
|
||||
// go1.26 `go vet` printf-pass panic on method expressions of anonymous structs.
|
||||
type embeddedAllocator struct{ allocator.Allocator }
|
||||
|
||||
@@ -39,9 +39,9 @@ func TestExternalCollectionRefreshChecker_NewChecker(t *testing.T) {
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
// Mock catalog methods
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -62,9 +62,9 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateFinished},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -83,9 +83,9 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateFailed},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -104,9 +104,9 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInit},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -128,11 +128,11 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress, Progress: 50},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -157,11 +157,11 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFinished, Progress: 100},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -186,11 +186,11 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFailed, Progress: 30, FailReason: "connection timeout"},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -215,11 +215,11 @@ func TestExternalCollectionRefreshChecker_AggregateJobState(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress, Progress: 60},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -246,9 +246,9 @@ func TestExternalCollectionRefreshChecker_TryTimeoutJob(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInProgress, StartTime: 0},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -269,9 +269,9 @@ func TestExternalCollectionRefreshChecker_TryTimeoutJob(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInProgress, StartTime: now},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -298,13 +298,13 @@ func TestExternalCollectionRefreshChecker_TryTimeoutJob(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
mockSaveTask := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(nil).Build()
|
||||
mockSaveTask := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(nil).Build()
|
||||
defer mockSaveTask.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -359,11 +359,11 @@ func TestExternalCollectionRefreshChecker_TryTimeoutJob(t *testing.T) {
|
||||
}
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{committedJob}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -398,11 +398,11 @@ func TestExternalCollectionRefreshChecker_TryTimeoutJob(t *testing.T) {
|
||||
{JobId: 99, CollectionId: 100, State: indexpb.JobState_JobStateInProgress, StartTime: oldStartTime},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -430,9 +430,9 @@ func TestExternalCollectionRefreshChecker_CheckGC(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -452,9 +452,9 @@ func TestExternalCollectionRefreshChecker_CheckGC(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateFinished, EndTime: 0},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -478,11 +478,11 @@ func TestExternalCollectionRefreshChecker_CheckGC(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateFinished, EndTime: oldEndTime},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockDropJob := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockDropJob := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockDropJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -509,13 +509,13 @@ func TestExternalCollectionRefreshChecker_CheckGC(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFailed},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockDropTask := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshTask")).Return(nil).Build()
|
||||
mockDropTask := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshTask).Return(nil).Build()
|
||||
defer mockDropTask.UnPatch()
|
||||
mockDropJob := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockDropJob := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockDropJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -539,9 +539,9 @@ func TestExternalCollectionRefreshChecker_CheckGC(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateFinished, EndTime: recentEndTime},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -562,9 +562,9 @@ func TestExternalCollectionRefreshChecker_Run(t *testing.T) {
|
||||
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -604,13 +604,13 @@ func TestExternalCollectionRefreshChecker_AggregateJobState_UpdateStateFailed(t
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress, Progress: 50},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
// Mock save to fail
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save failed")).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save failed")).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -636,11 +636,11 @@ func TestExternalCollectionRefreshChecker_AggregateJobState_FailedWithProgressUp
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFailed, Progress: 30, FailReason: "worker error"},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -669,11 +669,11 @@ func TestExternalCollectionRefreshChecker_AggregateJobState_FinishedApplyOnce(t
|
||||
{TaskId: 1002, JobId: 1, State: indexpb.JobState_JobStateFinished, Progress: 100, ResultReady: true},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -750,13 +750,13 @@ func TestExternalCollectionRefreshChecker_AggregateJobState_ClearsTaskResultsAft
|
||||
},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
mockSaveTask := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(nil).Build()
|
||||
mockSaveTask := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(nil).Build()
|
||||
defer mockSaveTask.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -788,13 +788,13 @@ func TestExternalCollectionRefreshChecker_TryTimeoutJob_UpdateStateFailed(t *tes
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInProgress, StartTime: oldStartTime},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
// Mock save to fail
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save failed")).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save failed")).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -820,13 +820,13 @@ func TestExternalCollectionRefreshChecker_CheckGC_DropJobFailed(t *testing.T) {
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateFinished, EndTime: oldEndTime},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
// Mock drop to fail
|
||||
mockDropJob := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshJob")).Return(errors.New("drop failed")).Build()
|
||||
mockDropJob := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshJob).Return(errors.New("drop failed")).Build()
|
||||
defer mockDropJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -847,9 +847,9 @@ func TestExternalCollectionRefreshChecker_LogJobStats(t *testing.T) {
|
||||
t.Run("empty_jobs", func(t *testing.T) {
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -863,9 +863,9 @@ func TestExternalCollectionRefreshChecker_LogJobStats(t *testing.T) {
|
||||
t.Run("multiple_states", func(t *testing.T) {
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -897,11 +897,11 @@ func TestExternalCollectionRefreshChecker_OnJobFinishedCallback(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFinished, Progress: 100},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -938,11 +938,11 @@ func TestExternalCollectionRefreshChecker_OnJobFinishedCallback(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFailed, Progress: 30, FailReason: "worker error"},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -973,11 +973,11 @@ func TestExternalCollectionRefreshChecker_OnJobFinishedCallback(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress, Progress: 60},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1004,11 +1004,11 @@ func TestExternalCollectionRefreshChecker_OnJobFinishedCallback(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFinished, Progress: 100},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1038,11 +1038,11 @@ func TestExternalCollectionRefreshChecker_OnJobFinishedCallback(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 42, State: indexpb.JobState_JobStateFailed, Progress: 40, FailReason: "boom"},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1069,11 +1069,11 @@ func TestExternalCollectionRefreshChecker_OnJobFinishedCallback(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 43, State: indexpb.JobState_JobStateFinished, Progress: 100},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(nil).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(nil).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1096,9 +1096,9 @@ func TestExternalCollectionRefreshChecker_RunGracefulShutdown(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1138,13 +1138,13 @@ func TestExternalCollectionRefreshChecker_AggregateJobState_ProgressOnlyUpdateFa
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress, Progress: 50},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
// Save succeeds for job state queries, but we'll mock UpdateJobProgress to fail
|
||||
mockSaveJob := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("progress save failed")).Build()
|
||||
mockSaveJob := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("progress save failed")).Build()
|
||||
defer mockSaveJob.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1173,9 +1173,9 @@ func TestExternalCollectionRefreshChecker_OnInitJobPending(t *testing.T) {
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 42, CollectionId: 100, State: indexpb.JobState_JobStateInit, TaskIds: nil},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1197,9 +1197,9 @@ func TestExternalCollectionRefreshChecker_OnInitJobPending(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 43, State: indexpb.JobState_JobStateInit},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -1218,9 +1218,9 @@ func TestExternalCollectionRefreshChecker_OnInitJobPending(t *testing.T) {
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 44, CollectionId: 100, State: indexpb.JobState_JobStateInProgress, TaskIds: nil},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, _ := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
|
||||
@@ -61,9 +61,9 @@ func TestExternalCollectionRefreshInspector_NewInspector(t *testing.T) {
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
// Mock catalog methods
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -86,9 +86,9 @@ func TestExternalCollectionRefreshInspector_Inspect(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInit},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -112,9 +112,9 @@ func TestExternalCollectionRefreshInspector_Inspect(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateRetry},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -138,9 +138,9 @@ func TestExternalCollectionRefreshInspector_Inspect(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -164,9 +164,9 @@ func TestExternalCollectionRefreshInspector_Inspect(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFinished},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -190,9 +190,9 @@ func TestExternalCollectionRefreshInspector_Inspect(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFailed},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -219,9 +219,9 @@ func TestExternalCollectionRefreshInspector_Inspect(t *testing.T) {
|
||||
{TaskId: 1004, JobId: 1, State: indexpb.JobState_JobStateFinished},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -249,9 +249,9 @@ func TestExternalCollectionRefreshInspector_ReloadFromMeta(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInit},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -275,9 +275,9 @@ func TestExternalCollectionRefreshInspector_ReloadFromMeta(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateRetry},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -301,9 +301,9 @@ func TestExternalCollectionRefreshInspector_ReloadFromMeta(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -327,9 +327,9 @@ func TestExternalCollectionRefreshInspector_ReloadFromMeta(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFinished},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -353,9 +353,9 @@ func TestExternalCollectionRefreshInspector_ReloadFromMeta(t *testing.T) {
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateFailed},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
@@ -383,9 +383,9 @@ func TestExternalCollectionRefreshInspector_ReloadFromMeta(t *testing.T) {
|
||||
{TaskId: 1005, JobId: 1, State: indexpb.JobState_JobStateFailed},
|
||||
}
|
||||
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
refreshMeta, _ := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
|
||||
@@ -518,7 +518,7 @@ func TestExternalCollectionRefreshManager_SubmitRefreshJobWithID(t *testing.T) {
|
||||
|
||||
// Mock AllocID to return error — triggers createTasksForJob failure
|
||||
// in the async Phase B goroutine.
|
||||
mockAllocID := mockey.Mock(mockey.GetMethod(alloc, "AllocID")).Return(int64(0), errors.New("alloc failed")).Build()
|
||||
mockAllocID := mockey.Mock((*stubAllocator).AllocID).Return(int64(0), errors.New("alloc failed")).Build()
|
||||
defer mockAllocID.UnPatch()
|
||||
|
||||
scheduler := newStubScheduler()
|
||||
|
||||
@@ -74,7 +74,7 @@ func TestExternalCollectionRefreshMeta_NewMeta(t *testing.T) {
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
// Mock ListExternalCollectionRefreshJobs to return error
|
||||
mockList := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, errors.New("list jobs error")).Build()
|
||||
mockList := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, errors.New("list jobs error")).Build()
|
||||
defer mockList.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -86,7 +86,7 @@ func TestExternalCollectionRefreshMeta_NewMeta(t *testing.T) {
|
||||
catalog := &stubCatalog{}
|
||||
|
||||
// Mock ListExternalCollectionRefreshTasks to return error
|
||||
mockList := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, errors.New("list tasks error")).Build()
|
||||
mockList := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, errors.New("list tasks error")).Build()
|
||||
defer mockList.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
@@ -125,7 +125,7 @@ func TestExternalCollectionRefreshMeta_AddJob(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Mock SaveExternalCollectionRefreshJob to return error
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
job := &datapb.ExternalCollectionRefreshJob{
|
||||
@@ -237,16 +237,16 @@ func TestExternalCollectionRefreshMeta_UpdateJobState(t *testing.T) {
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInit},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Mock save to fail
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
applied, err := meta.UpdateJobState(1, indexpb.JobState_JobStateInProgress, "")
|
||||
@@ -338,13 +338,13 @@ func TestExternalCollectionRefreshMeta_UpdateJobStateWithPreApply(t *testing.T)
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
var savedJob *datapb.ExternalCollectionRefreshJob
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).
|
||||
To(func(_ context.Context, job *datapb.ExternalCollectionRefreshJob) error {
|
||||
savedJob = job
|
||||
return nil
|
||||
@@ -376,15 +376,15 @@ func TestExternalCollectionRefreshMeta_UpdateJobStateWithPreApply(t *testing.T)
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 1, CollectionId: 100, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
preApplyCalled := false
|
||||
@@ -410,15 +410,15 @@ func TestExternalCollectionRefreshMeta_UpdateJobProgress(t *testing.T) {
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 1, CollectionId: 100, Progress: 0},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
err = meta.UpdateJobProgress(1, 50)
|
||||
@@ -453,15 +453,15 @@ func TestExternalCollectionRefreshMeta_AddTaskIDToJob(t *testing.T) {
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 1, CollectionId: 100, TaskIds: []int64{}},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshJob")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshJob).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
err = meta.AddTaskIDToJob(1, 1001)
|
||||
@@ -500,15 +500,15 @@ func TestExternalCollectionRefreshMeta_DropJob(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1, CollectionId: 100},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockDropTask := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshTask")).Return(errors.New("drop task error")).Build()
|
||||
mockDropTask := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshTask).Return(errors.New("drop task error")).Build()
|
||||
defer mockDropTask.UnPatch()
|
||||
|
||||
err = meta.DropJob(ctx, 1)
|
||||
@@ -523,16 +523,16 @@ func TestExternalCollectionRefreshMeta_DropJob(t *testing.T) {
|
||||
jobs := []*datapb.ExternalCollectionRefreshJob{
|
||||
{JobId: 1, CollectionId: 100},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(jobs, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(jobs, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(nil, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(nil, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Mock drop job to fail
|
||||
mockDropJob := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshJob")).Return(errors.New("drop job error")).Build()
|
||||
mockDropJob := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshJob).Return(errors.New("drop job error")).Build()
|
||||
defer mockDropJob.UnPatch()
|
||||
|
||||
err = meta.DropJob(ctx, 1)
|
||||
@@ -596,7 +596,7 @@ func TestExternalCollectionRefreshMeta_AddTask(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Mock SaveExternalCollectionRefreshTask to return error
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
task := &datapb.ExternalCollectionRefreshTask{
|
||||
@@ -685,15 +685,15 @@ func TestExternalCollectionRefreshMeta_UpdateTaskState(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInit},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
err = meta.UpdateTaskState(1001, indexpb.JobState_JobStateInProgress, "")
|
||||
@@ -742,13 +742,13 @@ func TestExternalCollectionRefreshMeta_UpdateTaskResult(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
var savedTask *datapb.ExternalCollectionRefreshTask
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).
|
||||
To(func(_ context.Context, task *datapb.ExternalCollectionRefreshTask) error {
|
||||
savedTask = task
|
||||
return nil
|
||||
@@ -787,15 +787,15 @@ func TestExternalCollectionRefreshMeta_UpdateTaskResult(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1, State: indexpb.JobState_JobStateInProgress},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
err = meta.UpdateTaskResult(
|
||||
@@ -847,13 +847,13 @@ func TestExternalCollectionRefreshMeta_ClearTaskResultsByJobID_PartialFailure(t
|
||||
UpdatedSegments: []*datapb.SegmentInfo{{ID: 20}},
|
||||
},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
saveCalls := 0
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).
|
||||
To(func(_ context.Context, task *datapb.ExternalCollectionRefreshTask) error {
|
||||
saveCalls++
|
||||
if task.GetTaskId() == 1002 {
|
||||
@@ -881,15 +881,15 @@ func TestExternalCollectionRefreshMeta_UpdateTaskProgress(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1, Progress: 0},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
err = meta.UpdateTaskProgress(1001, 50)
|
||||
@@ -924,15 +924,15 @@ func TestExternalCollectionRefreshMeta_UpdateTaskVersion(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1, Version: 0, NodeId: 0},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(context.Background(), catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(errors.New("save error")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(errors.New("save error")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
err = meta.UpdateTaskVersion(1001, 10)
|
||||
@@ -973,15 +973,15 @@ func TestExternalCollectionRefreshMeta_DropTask(t *testing.T) {
|
||||
tasks := []*datapb.ExternalCollectionRefreshTask{
|
||||
{TaskId: 1001, JobId: 1},
|
||||
}
|
||||
mockListJobs := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshJobs")).Return(nil, nil).Build()
|
||||
mockListJobs := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshJobs).Return(nil, nil).Build()
|
||||
defer mockListJobs.UnPatch()
|
||||
mockListTasks := mockey.Mock(mockey.GetMethod(catalog, "ListExternalCollectionRefreshTasks")).Return(tasks, nil).Build()
|
||||
mockListTasks := mockey.Mock((*stubCatalog).ListExternalCollectionRefreshTasks).Return(tasks, nil).Build()
|
||||
defer mockListTasks.UnPatch()
|
||||
|
||||
meta, err := newExternalCollectionRefreshMeta(ctx, catalog)
|
||||
assert.NoError(t, err)
|
||||
|
||||
mockDrop := mockey.Mock(mockey.GetMethod(catalog, "DropExternalCollectionRefreshTask")).Return(errors.New("drop error")).Build()
|
||||
mockDrop := mockey.Mock((*stubCatalog).DropExternalCollectionRefreshTask).Return(errors.New("drop error")).Build()
|
||||
defer mockDrop.UnPatch()
|
||||
|
||||
err = meta.DropTask(ctx, 1001)
|
||||
|
||||
@@ -2755,8 +2755,8 @@ func TestServer_DropSnapshot(t *testing.T) {
|
||||
defer mockGetSnapshot.UnPatch()
|
||||
|
||||
// Resolve collection via datacoord-local handler cache — no broker RPC.
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -2765,8 +2765,8 @@ func TestServer_DropSnapshot(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
mockBroadCaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadCaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
|
||||
mockBroadcast := mockey.Mock(broadcast.StartBroadcastWithResourceKeys).To(
|
||||
@@ -2812,8 +2812,8 @@ func TestServer_DropSnapshot(t *testing.T) {
|
||||
}).Build()
|
||||
defer mockHasPins.UnPatch()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -2822,14 +2822,14 @@ func TestServer_DropSnapshot(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
mockBroadCaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadCaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
|
||||
// Broadcast() must NOT be called — rejection happens before it.
|
||||
broadcastCalled := false
|
||||
mockBroadcastSend := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Broadcast).To(
|
||||
func(b *struct{ broadcaster.BroadcastAPI }, ctx context.Context, msg message.BroadcastMutableMessage) (*types2.BroadcastAppendResult, error) {
|
||||
mockBroadcastSend := mockey.Mock((*embeddedBroadcastAPI).Broadcast).To(
|
||||
func(b *embeddedBroadcastAPI, ctx context.Context, msg message.BroadcastMutableMessage) (*types2.BroadcastAppendResult, error) {
|
||||
broadcastCalled = true
|
||||
return nil, nil
|
||||
}).Build()
|
||||
@@ -2877,8 +2877,8 @@ func TestServer_DropSnapshot(t *testing.T) {
|
||||
}).Build()
|
||||
defer mockHasPins.UnPatch()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -2887,8 +2887,8 @@ func TestServer_DropSnapshot(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
mockBroadCaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadCaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
|
||||
mockBroadcast := mockey.Mock(broadcast.StartBroadcastWithResourceKeys).To(
|
||||
@@ -3187,8 +3187,8 @@ func TestServer_RestoreSnapshot(t *testing.T) {
|
||||
int64(0), 0, merr.WrapErrSnapshotNotFound("non_existent_snapshot")).Build()
|
||||
defer mockPin.UnPatch()
|
||||
|
||||
mockBroadCaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadCaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
|
||||
mockBroadcast := mockey.Mock(broadcast.StartBroadcastWithResourceKeys).To(
|
||||
@@ -3315,9 +3315,9 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
// failure must short-circuit before collection resolution. We still
|
||||
// patch it to assert it's never called.
|
||||
handlerCalled := false
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).To(
|
||||
func(_ *struct{ Handler }, _ context.Context, _ int64) (*collectionInfo, error) {
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).To(
|
||||
func(_ *embeddedHandler, _ context.Context, _ int64) (*collectionInfo, error) {
|
||||
handlerCalled = true
|
||||
return &collectionInfo{DatabaseName: "default", Schema: &schemapb.CollectionSchema{Name: "test_coll"}}, nil
|
||||
}).Build()
|
||||
@@ -3358,8 +3358,8 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
defer mockGet.UnPatch()
|
||||
|
||||
// Resolve collection via local handler cache — no broker RPC.
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "default",
|
||||
@@ -3378,8 +3378,8 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
}).Build()
|
||||
defer mockBroadcast.UnPatch()
|
||||
|
||||
fakeBroker := &struct{ broker.Broker }{}
|
||||
mockHasCollection := mockey.Mock((*struct{ broker.Broker }).HasCollection).Return(true, nil).Build()
|
||||
fakeBroker := &embeddedBroker{}
|
||||
mockHasCollection := mockey.Mock((*embeddedBroker).HasCollection).Return(true, nil).Build()
|
||||
defer mockHasCollection.UnPatch()
|
||||
|
||||
server := &Server{
|
||||
@@ -3409,8 +3409,8 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGet.UnPatch()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "default",
|
||||
@@ -3420,11 +3420,11 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
broadcastCalled := false
|
||||
mockBroadcaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadcaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockDoBroadcast := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Broadcast).To(
|
||||
func(_ *struct{ broadcaster.BroadcastAPI }, _ context.Context, _ message.BroadcastMutableMessage) (*types2.BroadcastAppendResult, error) {
|
||||
mockDoBroadcast := mockey.Mock((*embeddedBroadcastAPI).Broadcast).To(
|
||||
func(_ *embeddedBroadcastAPI, _ context.Context, _ message.BroadcastMutableMessage) (*types2.BroadcastAppendResult, error) {
|
||||
broadcastCalled = true
|
||||
return &types2.BroadcastAppendResult{}, nil
|
||||
}).Build()
|
||||
@@ -3436,9 +3436,9 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
defer mockStartBroadcast.UnPatch()
|
||||
|
||||
hasCollectionCalled := false
|
||||
fakeBroker := &struct{ broker.Broker }{}
|
||||
mockHasCollection := mockey.Mock((*struct{ broker.Broker }).HasCollection).To(
|
||||
func(_ *struct{ broker.Broker }, _ context.Context, collectionID int64) (bool, error) {
|
||||
fakeBroker := &embeddedBroker{}
|
||||
mockHasCollection := mockey.Mock((*embeddedBroker).HasCollection).To(
|
||||
func(_ *embeddedBroker, _ context.Context, collectionID int64) (bool, error) {
|
||||
hasCollectionCalled = true
|
||||
assert.Equal(t, int64(100), collectionID)
|
||||
return false, nil
|
||||
@@ -3472,8 +3472,8 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGet.UnPatch()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "default",
|
||||
@@ -3483,11 +3483,11 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
broadcastCalled := false
|
||||
mockBroadcaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadcaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockDoBroadcast := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Broadcast).To(
|
||||
func(_ *struct{ broadcaster.BroadcastAPI }, _ context.Context, _ message.BroadcastMutableMessage) (*types2.BroadcastAppendResult, error) {
|
||||
mockDoBroadcast := mockey.Mock((*embeddedBroadcastAPI).Broadcast).To(
|
||||
func(_ *embeddedBroadcastAPI, _ context.Context, _ message.BroadcastMutableMessage) (*types2.BroadcastAppendResult, error) {
|
||||
broadcastCalled = true
|
||||
return &types2.BroadcastAppendResult{}, nil
|
||||
}).Build()
|
||||
@@ -3498,8 +3498,8 @@ func TestServer_CreateSnapshot_AdditionalCases(t *testing.T) {
|
||||
}).Build()
|
||||
defer mockStartBroadcast.UnPatch()
|
||||
|
||||
fakeBroker := &struct{ broker.Broker }{}
|
||||
mockHasCollection := mockey.Mock((*struct{ broker.Broker }).HasCollection).Return(
|
||||
fakeBroker := &embeddedBroker{}
|
||||
mockHasCollection := mockey.Mock((*embeddedBroker).HasCollection).Return(
|
||||
false, errors.New("rootcoord unavailable"),
|
||||
).Build()
|
||||
defer mockHasCollection.UnPatch()
|
||||
@@ -3537,8 +3537,8 @@ func TestServer_PinSnapshotData_AcquiresResourceKeyLock(t *testing.T) {
|
||||
|
||||
// Resolve collection identity from datacoord-local handler cache — no
|
||||
// broker RPC on the hot path.
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -3550,8 +3550,8 @@ func TestServer_PinSnapshotData_AcquiresResourceKeyLock(t *testing.T) {
|
||||
// Record which resource keys were requested, and assert the call order.
|
||||
var capturedKeys []message.ResourceKey
|
||||
lockAcquired := false
|
||||
mockBroadcaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadcaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockBroadcast := mockey.Mock(broadcast.StartBroadcastWithResourceKeys).To(
|
||||
func(ctx context.Context, keys ...message.ResourceKey) (broadcaster.BroadcastAPI, error) {
|
||||
@@ -3620,8 +3620,8 @@ func TestServer_PinSnapshotData_AcquiresResourceKeyLock(t *testing.T) {
|
||||
// handler.GetCollection returning an error (collection not in datacoord
|
||||
// cache AND rootcoord fallback failed) must surface to the user rather
|
||||
// than fall through into the broadcast path.
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
nil, errors.New("collection gone"),
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
@@ -3647,8 +3647,8 @@ func TestServer_PinSnapshotData_AcquiresResourceKeyLock(t *testing.T) {
|
||||
// ErrCollectionNotFound so the client sees a clear error.
|
||||
ctx := context.Background()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
nil, nil,
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
@@ -3672,8 +3672,8 @@ func TestServer_PinSnapshotData_AcquiresResourceKeyLock(t *testing.T) {
|
||||
t.Run("lock_acquisition_failed", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -4725,9 +4725,9 @@ func TestServer_RefreshExternalCollection(t *testing.T) {
|
||||
|
||||
// Bypass startBroadcast (broker not wired in test) and the new
|
||||
// duplicate-active-job pre-check (refreshMeta is nil here).
|
||||
mockStartBroadcast := mockey.Mock((*Server).startBroadcastWithCollectionID).Return(&struct{ broadcaster.BroadcastAPI }{}, nil).Build()
|
||||
mockStartBroadcast := mockey.Mock((*Server).startBroadcastWithCollectionID).Return(&embeddedBroadcastAPI{}, nil).Build()
|
||||
defer mockStartBroadcast.UnPatch()
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockGetActive := mockey.Mock((*externalCollectionRefreshManager).GetActiveJobByCollectionID).Return(nil).Build()
|
||||
defer mockGetActive.UnPatch()
|
||||
@@ -4750,9 +4750,9 @@ func TestServer_RefreshExternalCollection(t *testing.T) {
|
||||
}
|
||||
server.stateCode.Store(commonpb.StateCode_Healthy)
|
||||
|
||||
mockStartBroadcast := mockey.Mock((*Server).startBroadcastWithCollectionID).Return(&struct{ broadcaster.BroadcastAPI }{}, nil).Build()
|
||||
mockStartBroadcast := mockey.Mock((*Server).startBroadcastWithCollectionID).Return(&embeddedBroadcastAPI{}, nil).Build()
|
||||
defer mockStartBroadcast.UnPatch()
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockGetActive := mockey.Mock((*externalCollectionRefreshManager).GetActiveJobByCollectionID).Return(&datapb.ExternalCollectionRefreshJob{
|
||||
JobId: 12345,
|
||||
@@ -5266,8 +5266,8 @@ func TestPinSnapshotData(t *testing.T) {
|
||||
t.Run("success", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -5276,8 +5276,8 @@ func TestPinSnapshotData(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
mockBroadcaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadcaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockBroadcast := mockey.Mock(broadcast.StartBroadcastWithResourceKeys).To(
|
||||
func(ctx context.Context, keys ...message.ResourceKey) (broadcaster.BroadcastAPI, error) {
|
||||
@@ -5312,8 +5312,8 @@ func TestPinSnapshotData(t *testing.T) {
|
||||
t.Run("pin_error", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
fakeHandler := &struct{ Handler }{}
|
||||
mockGetColl := mockey.Mock((*struct{ Handler }).GetCollection).Return(
|
||||
fakeHandler := &embeddedHandler{}
|
||||
mockGetColl := mockey.Mock((*embeddedHandler).GetCollection).Return(
|
||||
&collectionInfo{
|
||||
ID: 100,
|
||||
DatabaseName: "test_db",
|
||||
@@ -5322,8 +5322,8 @@ func TestPinSnapshotData(t *testing.T) {
|
||||
).Build()
|
||||
defer mockGetColl.UnPatch()
|
||||
|
||||
mockBroadcaster := &struct{ broadcaster.BroadcastAPI }{}
|
||||
mockClose := mockey.Mock((*struct{ broadcaster.BroadcastAPI }).Close).Return().Build()
|
||||
mockBroadcaster := &embeddedBroadcastAPI{}
|
||||
mockClose := mockey.Mock((*embeddedBroadcastAPI).Close).Return().Build()
|
||||
defer mockClose.UnPatch()
|
||||
mockBroadcast := mockey.Mock(broadcast.StartBroadcastWithResourceKeys).To(
|
||||
func(ctx context.Context, keys ...message.ResourceKey) (broadcaster.BroadcastAPI, error) {
|
||||
@@ -5568,3 +5568,12 @@ func TestHandleCommitVchannelRPC_StoresCommitTimestamp(t *testing.T) {
|
||||
assert.False(t, seg.GetIsImporting())
|
||||
}
|
||||
}
|
||||
|
||||
// Named helper types for mockey interface-method patching. Using named types
|
||||
// instead of anonymous struct{ Iface } avoids a go1.26 `go vet` printf-pass
|
||||
// panic in x/tools refactor/satisfy on method expressions of *struct{...}.
|
||||
type (
|
||||
embeddedHandler struct{ Handler }
|
||||
embeddedBroadcastAPI struct{ broadcaster.BroadcastAPI }
|
||||
embeddedBroker struct{ broker.Broker }
|
||||
)
|
||||
|
||||
@@ -690,7 +690,7 @@ func TestRefreshExternalCollectionTask_CreateTaskOnWorker(t *testing.T) {
|
||||
task := newRefreshExternalCollectionTask(protoTask, refreshMeta, mt, alloc)
|
||||
|
||||
// Mock SaveExternalCollectionRefreshTask to return error
|
||||
mockSave := mockey.Mock(mockey.GetMethod(catalog, "SaveExternalCollectionRefreshTask")).Return(errors.New("save failed")).Build()
|
||||
mockSave := mockey.Mock((*stubCatalog).SaveExternalCollectionRefreshTask).Return(errors.New("save failed")).Build()
|
||||
defer mockSave.UnPatch()
|
||||
|
||||
cluster := &stubCluster{}
|
||||
@@ -725,7 +725,7 @@ func TestRefreshExternalCollectionTask_CreateTaskOnWorker(t *testing.T) {
|
||||
task := newRefreshExternalCollectionTask(protoTask, refreshMeta, mt, alloc)
|
||||
|
||||
// Mock AllocN to return error
|
||||
mockAllocN := mockey.Mock(mockey.GetMethod(alloc, "AllocN")).Return(int64(0), int64(0), errors.New("alloc batch failed")).Build()
|
||||
mockAllocN := mockey.Mock((*stubAllocator).AllocN).Return(int64(0), int64(0), errors.New("alloc batch failed")).Build()
|
||||
defer mockAllocN.UnPatch()
|
||||
|
||||
cluster := &stubCluster{}
|
||||
@@ -805,7 +805,7 @@ func TestRefreshExternalCollectionTask_CreateTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock CreateRefreshExternalCollectionTask to return error
|
||||
mockCreate := mockey.Mock(mockey.GetMethod(cluster, "CreateRefreshExternalCollectionTask")).Return(errors.New("create task failed")).Build()
|
||||
mockCreate := mockey.Mock((*stubCluster).CreateRefreshExternalCollectionTask).Return(errors.New("create task failed")).Build()
|
||||
defer mockCreate.UnPatch()
|
||||
|
||||
task.CreateTaskOnWorker(1, cluster)
|
||||
@@ -974,7 +974,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock QueryRefreshExternalCollectionTask to return error
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(nil, errors.New("query failed")).Build()
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(nil, errors.New("query failed")).Build()
|
||||
defer mockQuery.UnPatch()
|
||||
|
||||
task.QueryTaskOnWorker(cluster)
|
||||
@@ -1061,7 +1061,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock QueryRefreshExternalCollectionTask to return failed state
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFailed,
|
||||
FailReason: "worker error",
|
||||
}, nil).Build()
|
||||
@@ -1126,7 +1126,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock QueryRefreshExternalCollectionTask to return Finished with response
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFinished,
|
||||
KeptSegments: []int64{1},
|
||||
UpdatedSegments: []*datapb.SegmentInfo{
|
||||
@@ -1186,7 +1186,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock QueryRefreshExternalCollectionTask to return Finished
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFinished,
|
||||
}, nil).Build()
|
||||
defer mockQuery.UnPatch()
|
||||
@@ -1236,7 +1236,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Worker reports JobStateNone — task hasn't been picked up yet.
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateNone,
|
||||
}, nil).Build()
|
||||
defer mockQuery.UnPatch()
|
||||
@@ -1285,7 +1285,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Worker reports JobStateInit — task accepted but not yet running.
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateInit,
|
||||
}, nil).Build()
|
||||
defer mockQuery.UnPatch()
|
||||
@@ -1331,7 +1331,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// JobStateRetry is the only state still considered unexpected.
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateRetry,
|
||||
}, nil).Build()
|
||||
defer mockQuery.UnPatch()
|
||||
@@ -1386,7 +1386,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker_FinishedSuccess(t *test
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock QueryRefreshExternalCollectionTask to return Finished with response
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFinished,
|
||||
KeptSegments: []int64{},
|
||||
UpdatedSegments: []*datapb.SegmentInfo{
|
||||
@@ -1451,7 +1451,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker_DelaysSegmentUpdateUnti
|
||||
}
|
||||
|
||||
cluster := &stubCluster{}
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFinished,
|
||||
KeptSegments: []int64{},
|
||||
UpdatedSegments: []*datapb.SegmentInfo{
|
||||
@@ -2005,7 +2005,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker_FinishedValidateSourceF
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock query to return Finished
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFinished,
|
||||
}, nil).Build()
|
||||
defer mockQuery.UnPatch()
|
||||
@@ -2054,7 +2054,7 @@ func TestRefreshExternalCollectionTask_QueryTaskOnWorker_FinishedPersistsResultW
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock query to return Finished
|
||||
mockQuery := mockey.Mock(mockey.GetMethod(cluster, "QueryRefreshExternalCollectionTask")).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
mockQuery := mockey.Mock((*stubCluster).QueryRefreshExternalCollectionTask).Return(&datapb.RefreshExternalCollectionTaskResponse{
|
||||
State: indexpb.JobState_JobStateFinished,
|
||||
KeptSegments: []int64{10},
|
||||
UpdatedSegments: []*datapb.SegmentInfo{
|
||||
@@ -2317,7 +2317,7 @@ func TestRefreshExternalCollectionTask_DropTaskOnWorker(t *testing.T) {
|
||||
cluster := &stubCluster{}
|
||||
|
||||
// Mock DropRefreshExternalCollectionTask to return error
|
||||
mockDrop := mockey.Mock(mockey.GetMethod(cluster, "DropRefreshExternalCollectionTask")).Return(errors.New("drop failed")).Build()
|
||||
mockDrop := mockey.Mock((*stubCluster).DropRefreshExternalCollectionTask).Return(errors.New("drop failed")).Build()
|
||||
defer mockDrop.UnPatch()
|
||||
|
||||
task.DropTaskOnWorker(cluster)
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
module github.com/milvus-io/milvus/pkg/v3
|
||||
|
||||
go 1.25.10
|
||||
go 1.26.4
|
||||
|
||||
require (
|
||||
cloud.google.com/go/storage v1.50.0
|
||||
@@ -155,7 +155,7 @@ require (
|
||||
github.com/hashicorp/memberlist v0.5.3 // indirect
|
||||
github.com/ianlancetaylor/cgosymbolizer v0.0.0-20221217025313-27d3c9f66b6a // indirect
|
||||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
|
||||
+2
-3
@@ -444,8 +444,8 @@ github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zt
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
@@ -960,7 +960,6 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.25.8 as builder
|
||||
FROM golang:1.26.4 as builder
|
||||
|
||||
# Define a build argument with an empty default value
|
||||
ARG CUSTOM_GOPROXY=""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/milvus-io/milvus/tests/go_client
|
||||
|
||||
go 1.25.10
|
||||
go 1.26.4
|
||||
|
||||
require (
|
||||
github.com/apache/arrow/go/v17 v17.0.0
|
||||
@@ -63,7 +63,7 @@ require (
|
||||
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
|
||||
github.com/klauspost/asmfmt v1.3.2 // indirect
|
||||
github.com/klauspost/compress v1.18.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a // indirect
|
||||
|
||||
@@ -214,8 +214,8 @@ github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uq
|
||||
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
|
||||
github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
|
||||
Reference in New Issue
Block a user