package main import ( "context" "git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep" "strings" "testing" "time" "git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep/conformance" buildrun "git.novox.be/novox/mesh-delivery/sdk/buildrun" sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep" "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) []sdkstep.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) []sdkstep.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 buildrun.Scan, node string, before time.Time, logf func(string, ...any)) { (&Module{Node: node}).endLeftRunning(ctx, scan, before, logf) }) } // ADR 0664 ยง1 (issue 1748): the module's own paths from a failed fetch or install to its step's error say a network that did // not answer as a transport fault, and a failure of the source (a package the registry lacks) as none. func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { conformance.Passing(t, []string{conformance.GitFetch, conformance.NpmCI}, func(runner, words string) error { switch runner { case conformance.GitFetch: run := func(context.Context, []string, string, ...string) forgekey.Ran { return forgekey.Ran{Status: 128, Stderr: words} } return buildstep.FetchCommit(context.Background(), run, t.TempDir(), "ssh://mesh-forge/o/r.git", strings.Repeat("a", 40), "") default: bad := &fakeNpm{ran: forgekey.Ran{Status: 1, Stderr: words}} return toolchainIn(t, bad).Ensure(context.Background(), Recipe{Steps: "k", Lock: "k"}.Version()) } }) }