test(catalog_spark): bound weed shell invocation with 30s timeout

createTableBucket ran `weed shell` via exec.Command with no deadline.
When the shell's first command retries on a transient master connection
blip, the trailing `exit` on stdin never gets processed and the
subprocess blocks until the outer 20m `go test` timeout fires — the
surfacing symptom is a flaky 20m panic with no diagnostic output.

Wrap the invocation in exec.CommandContext with a 30s timeout, matching
the existing pattern in test/s3tables/catalog_risingwave/setup_test.go.
This commit is contained in:
Chris Lu
2026-04-21 23:27:10 -07:00
parent 7f67995c24
commit 96e5fea08e
+4 -1
View File
@@ -323,8 +323,11 @@ spark = (SparkSession.builder
func createTableBucket(t *testing.T, env *TestEnvironment, bucketName string) {
t.Helper()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
masterGrpcPort := env.masterPort + 10000
cmd := exec.Command("weed", "shell",
cmd := exec.CommandContext(ctx, "weed", "shell",
fmt.Sprintf("-master=localhost:%d.%d", env.masterPort, masterGrpcPort),
)
cmd.Stdin = strings.NewReader(fmt.Sprintf("s3tables.bucket -create -name %s -account 000000000000\nexit\n", bucketName))