mesh-knowledge: give the bus test's bundle a fixed clock, so it passes on any day (issue 540)
The bundle dated a reservation from the real day while the proposal kept the fixture's 2026-10-11, so the date rule refused it on every later day.
This commit is contained in:
@@ -28,10 +28,15 @@ import (
|
|||||||
|
|
||||||
const bundleVar = "MESH_KNOWLEDGE_TEST_BUNDLE"
|
const bundleVar = "MESH_KNOWLEDGE_TEST_BUNDLE"
|
||||||
|
|
||||||
|
// bundleDay is the bundle's clock: the day the fixture's proposals are dated (valid's Date), so a reservation and the
|
||||||
|
// proposal after it are of one day whatever day the test runs on (issue 540).
|
||||||
|
var bundleDay = time.Date(2026, 10, 11, 9, 0, 0, 0, time.UTC)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
if os.Getenv(bundleVar) == "1" {
|
if os.Getenv(bundleVar) == "1" {
|
||||||
// The bundle the bus test starts: the knowledge base as the runtime launches it, its store in memory.
|
// The bundle the bus test starts: the knowledge base as the runtime launches it, its store in memory.
|
||||||
k := newKB(newMemStore())
|
k := newKB(newMemStore())
|
||||||
|
k.Now = func() time.Time { return bundleDay }
|
||||||
serve(k, os.Getenv("MESH_KNOWLEDGE_STATUS"))
|
serve(k, os.Getenv("MESH_KNOWLEDGE_STATUS"))
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user