Merge pull request 'Let gitea's forge-account provider read the assignments it learns its consumers from (issue 955)' (#341) from fix/955-gitea-reads-assignments into main
This commit was merged in pull request #341.
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -20,3 +23,24 @@ func TestConfigFromEnvNamesWhatIsMissing(t *testing.T) {
|
|||||||
t.Fatalf("%v", err)
|
t.Fatalf("%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue 955: the runtime grants a module only the states its manifest `reads`, and the provider watches the machines'
|
||||||
|
// keys and, through the SDK's provider, the controller's assignments (where it learns its consumers). Run as the
|
||||||
|
// bus test does, with every bucket made, a missing grant passes unseen; the manifest is read here instead.
|
||||||
|
func TestTheManifestReadsEveryStateTheProviderWatches(t *testing.T) {
|
||||||
|
raw, err := os.ReadFile("../../module.json")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var m struct {
|
||||||
|
Reads []string `json:"reads"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(raw, &m); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, state := range []string{"mesh-controller.assignments", "ssh-client.keys"} {
|
||||||
|
if !slices.Contains(m.Reads, state) {
|
||||||
|
t.Errorf("gitea's reads %v lack %q, so the runtime refuses its watch", m.Reads, state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -501,6 +501,7 @@
|
|||||||
"bound"
|
"bound"
|
||||||
],
|
],
|
||||||
"reads": [
|
"reads": [
|
||||||
|
"mesh-controller.assignments",
|
||||||
"ssh-client.keys"
|
"ssh-client.keys"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user