mini: clear the vector state a previous in-process run prepared

prepareMiniVector returned early without clearing the paths and key an
earlier run in the same process had set, so a rerun with
-vector.worker=false still started that run's weed-worker.
This commit is contained in:
Chris Lu committed 2026-12-01 00:12:06 -08:00
1 parent d63b7d5125
commit 53ef2c9239
2 files changed
+2 -2

No files matched your search

+1
View File
@@ -55,6 +55,7 @@ func miniSecurityToml(env string) string {
// signed with a key derived from jwt.filer_signing.key, so when the cluster
// has none, the namespace and the worker share a key made for this run.
func prepareMiniVector() {
miniVectorPath, miniVectorWorkerPath, miniS3Options.lanceWorkerKey = "", "", nil
if !*miniVector {
return
}
+1 -2
View File
@@ -37,14 +37,13 @@ func TestPrepareMiniVector(t *testing.T) {
wantKey bool
}{
{"both installed", true, true, "weed-vector", "weed-worker", "", true, vector, worker, true},
{"-vector.worker=false after a run that started it", true, false, "weed-vector", "weed-worker", "", true, vector, "", false},
{"cluster key configured", true, true, "weed-vector", "weed-worker", "cluster-key", true, vector, worker, false},
{"weed-worker not installed", true, true, "weed-vector", missing, "", true, vector, "", false},
{"weed-vector not installed", true, true, missing, "weed-worker", "", false, "", "", false},
{"-vector.worker=false", true, false, "weed-vector", "weed-worker", "", true, vector, "", false},
{"-vector=false", false, true, "weed-vector", "weed-worker", "", false, "", "", false},
} {
*miniVector, *miniVectorWorker, *miniVectorBinary, *miniVectorWorkerBinary = tc.vector, tc.startWorker, tc.vectorBinary, tc.workerBinary
miniVectorPath, miniVectorWorkerPath, miniS3Options.lanceWorkerKey = "", "", nil
util.GetViper().Set("jwt.filer_signing.key", tc.clusterKey)
prepareMiniVector()
if *miniVector != tc.wantVector || miniVectorPath != tc.wantVectorPath || miniVectorWorkerPath != tc.wantWorker || (len(miniS3Options.lanceWorkerKey) == 64) != tc.wantKey {