From cf965b93c25ff566a999432dcffb86043f25795f Mon Sep 17 00:00:00 2001 From: mesh-tools Date: Tue, 20 Oct 2026 07:06:26 +0000 Subject: [PATCH] Test the grant of a consumer on the provider's own node (review round 2, item 2); it failed before the previous commit --- go/compose/credentials_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/go/compose/credentials_test.go b/go/compose/credentials_test.go index cbf37d4..ba4db0c 100644 --- a/go/compose/credentials_test.go +++ b/go/compose/credentials_test.go @@ -469,3 +469,19 @@ func TestTheInternalSuffixIsTheInputsAndNeverTheEnvironments(t *testing.T) { t.Errorf("names: %v", names) } } + +// Round 2: a need answered on the same machine is a grant too (catalogue resolve.go gives it From: the node's own name). +func TestAConsumerOnTheProvidersOwnNodeIsGrantedWithAStandInAndNamedForeseen(t *testing.T) { + in := aGrantMesh(t) + in.Issued = nil + laptop, anchor := nodeOf(t, &in, "laptop"), nodeOf(t, &in, "anchor") + laptop.Assigned = []string{overlay.Name} + anchor.Assigned = append(anchor.Assigned, "files") + got := rendered(t, in, "anchor", Foreseeing) + if len(got.Rendering.Grants) != 1 || got.Rendering.Grants[0].Consumer != "anchor" || got.Rendering.Grants[0].Sealed != catalogue.ForeseenSealed { + t.Fatalf("grants are %+v", got.Rendering.Grants) + } + if !has(got.Foreseen, "the grant of s3-bucket for files on anchor") { + t.Errorf("foreseen %v", got.Foreseen) + } +}