Files
mesh-delivery/modules/mesh-delivery-assigner/internal/buckets/buckets_test.go
T
jschoubben ef5e5d13e0 assigner: the state composition-runs, one key per candidate and machine (A1)
A composition run is kept once per candidate and machine, so steps of one candidate share
it: the key is written create-only, a reader is the step's StepRun with its ask id, a run
that could not run is replaced, a run past composition-runs-kept goes at the next start,
and at the cap no run starts, naming the fill. The settings reach the process through
resource files.

Builds: design 47 G §718, §719, §720 (could not run is never read); A-468, A-468b, A-468c, A-469d, A-469w, A-469x, A-470
2026-11-17 11:26:51 +01:00

42 lines
1.9 KiB
Go

package buckets
import (
"testing"
plc "mesh-delivery-assigner/internal/assignment"
)
// The names are the ones the earlier shared form held (mesh-sdk's go/delivery), and the ones the manifest's reads and
// states say: a bucket is `<module>_<state>`.
func TestBucketsAreTheEarlierNames(t *testing.T) {
for name, c := range map[string][2]string{
"Have": {Have, "node-engine_have"}, "ComposedRead": {ComposedRead, "mesh-host.composed"},
"Modules": {Modules, "mesh-delivery-indexer_modules"}, "Manifests": {Manifests, "mesh-delivery-indexer_manifests"},
"Answers": {Answers, "mesh-delivery-teller_answers"},
"Grants": {Grants, "mesh-grants_grants"},
"Provisions": {Provisions, "mesh-provisioner_provisions"}, "TellerModule": {TellerModule, "mesh-delivery-teller"},
} {
if c[0] != c[1] {
t.Errorf("%s = %q, want %q", name, c[0], c[1])
}
}
}
// The assigner's own buckets are named from the module it runs as, its credential's, never from a constant of its name
// (design 47 G A-296, §428): a bucket is `<module>_<state>` of whatever module SetModule was told.
func TestTheAssignersOwnBucketsTakeTheModuleItRunsAs(t *testing.T) {
defer plc.SetModule(plc.Module())
plc.SetModule("some-assigner")
for name, c := range map[string][2]string{
"Wants": {Wants(), "some-assigner_wants"}, "Differences": {Differences(), "some-assigner_differences"},
"Asks": {Asks(), "some-assigner_asks"}, "Puts": {Puts(), "some-assigner_puts"}, "Policies": {Policies(), "some-assigner_policies"},
"Waits": {Waits(), "some-assigner_waits"}, "Inputs": {Inputs(), "some-assigner_inputs"},
"CompositionRuns": {CompositionRuns(), "some-assigner_composition-runs"},
"Assignments": {plc.AssignmentsBucket(), "some-assigner_assignments"}, "SeatHolders": {plc.SeatHoldersBucket(), "some-assigner_seat-holders"},
} {
if c[0] != c[1] {
t.Errorf("%s = %q, want %q", name, c[0], c[1])
}
}
}