Files
mesh-catalog/modules/mesh-build-node/cmd/mesh-build-node/kit_test.go
T
jochen 3d42988afa Hold every build module to ending what a previous process left running (issue 1890)
A replaced mesh-build-go left a check ask's step running and its start
sweep spared it (issue 1890, note 21). mesh-build-go, mesh-build-node and
mesh-build-image pin mesh-sdk 981a35b5, whose steps name their owner and
whose sweep ends another owner's at once; each runs the sweep through one
method that main calls and that its test runs through the conformance
kit's left-running case. The failurekit check now refuses a build module
whose tests do not run that case, test step or not.
2026-10-27 01:22:13 +01:00

32 lines
1.4 KiB
Go

package main
import (
"context"
"testing"
"time"
"git.novox.be/novox/mesh-sdk/go/buildstep"
"git.novox.be/novox/mesh-sdk/go/buildstep/conformance"
"git.novox.be/novox/mesh-sdk/go/forgekey"
)
// 1901/AC7: the module's own parse path (testFailures, as the test step calls it on a command that failed) keeps the
// failure contract on every captured node --test and tsc case of the SDK's conformance kit.
func TestTheTestStepKeepsTheFailureContract(t *testing.T) {
conformance.Run(t, conformance.NodeTest, func(o conformance.Output) []buildstep.Failure {
return testFailures(".", "test", o.Dir, forgekey.Ran{Status: 1, Stdout: o.Stdout, Stderr: o.Stderr}, o.Report)
})
conformance.Run(t, conformance.TypeCheck, func(o conformance.Output) []buildstep.Failure {
return testFailures(".", "type-check", o.Dir, forgekey.Ran{Status: 2, Stdout: o.Stdout, Stderr: o.Stderr}, "")
})
}
// 1890/AC7: the module's own start sweep (endLeftRunning, as main runs it) keeps the conformance kit's left-running
// case: a step a previous process left running is ended at once and said, whatever its age, and a step of this process
// is kept.
func TestTheStartSweepEndsWhatAPreviousProcessLeft(t *testing.T) {
conformance.LeftRunning(t, func(ctx context.Context, scan buildstep.Scan, node string, before time.Time, logf func(string, ...any)) {
(&Module{Node: node}).endLeftRunning(ctx, scan, before, logf)
})
}