From d06d67436b80171cd65528bbf507575b24d73c62 Mon Sep 17 00:00:00 2001 From: Bakhtiyar Issakhmetov Date: Sat, 5 Sep 2026 16:01:33 +0500 Subject: [PATCH] test(landscape): make node-failure test deterministic under sibling cancellation Scope the stub publisher failure to node 00's output; when every stage-0 publish failed, the first failing sibling cancelled node 00 and its recorded error was "context canceled" instead of the publish error. Co-Authored-By: Claude Fable 5.1 --- internal/service/landscape_test.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/internal/service/landscape_test.go b/internal/service/landscape_test.go index 1fc4244..a4ea7a7 100644 --- a/internal/service/landscape_test.go +++ b/internal/service/landscape_test.go @@ -332,11 +332,15 @@ type stubPublisher struct { created []CreateRasterInput uploaded []UploadInput err error + // errFilename, when set, scopes err to publishes of that output file only, + // so a test can fail exactly one node while its stage siblings succeed + // (a sibling failing first would cancel the node under test). + errFilename string } func (p *stubPublisher) CreateRasterFromFile(ctx context.Context, in CreateRasterInput) (domain.Dataset, error) { p.mu.Lock() - if p.err != nil { + if p.err != nil && (p.errFilename == "" || p.errFilename == in.Filename) { p.mu.Unlock() return domain.Dataset{}, p.err } @@ -1234,9 +1238,15 @@ func TestLandscapeService_Execute_NodeFailureFailsRunAndCleansUp(t *testing.T) { want: "grid mismatch", }, { - name: "publishing the result fails", - arrange: func(f *lpFixture) { f.pub.err = errors.New("minio down") }, - want: "minio down", + name: "publishing the result fails", + arrange: func(f *lpFixture) { + // Fail only node 00's output: if every stage-0 publish failed, + // whichever sibling failed first would cancel node 00 and its + // recorded error would be "context canceled" instead. + f.pub.err = errors.New("minio down") + f.pub.errFilename = landscape.OutZIntegrated + ".tif" + }, + want: "minio down", }, }