Merge pull request 'G-24 tests on main: mesh-build-go keeps no step-code bridge, uses a stand-in composer, and runs within its level bounds' (#699) from fix/g24-tests-on-main into main
This commit was merged in pull request #699.
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
// Package buildstep is kept empty as a bridge: the running pre-G indexer publishes mesh-catalog's packages only while
|
|
||||||
// every package directory it published before is in the tree. It goes once G's indexer runs.
|
|
||||||
package buildstep
|
|
||||||
@@ -58,6 +58,7 @@ func main() {
|
|||||||
// compiles that program and runs it shut off, answers its mark judged by the candidate at the tree's commit, and the
|
// compiles that program and runs it shut off, answers its mark judged by the candidate at the tree's commit, and the
|
||||||
// program reached no key, no login, no name and no socket of the machine.
|
// program reached no key, no login, no name and no socket of the machine.
|
||||||
func TestTheUnitLevelUnderTheWorkspaceRunnerRunsTheTreesProgramShutOff(t *testing.T) {
|
func TestTheUnitLevelUnderTheWorkspaceRunnerRunsTheTreesProgramShutOff(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the candidate's program shut off", "go", "git", "bwrap")
|
needTools(t, "the candidate's program shut off", "go", "git", "bwrap")
|
||||||
home := t.TempDir()
|
home := t.TempDir()
|
||||||
key, login := filepath.Join(home, ".ssh", "mesh_ed25519"), filepath.Join(home, "broker")
|
key, login := filepath.Join(home, ".ssh", "mesh_ed25519"), filepath.Join(home, "broker")
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ func TestACandidateThatDoesNotCompileFailsTheStepWithTheCompilersFirstErrorAndRu
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTheInstalledProgramSaysItJudged(t *testing.T) { // 1898 K1, ADR 0535 §5
|
func TestTheInstalledProgramSaysItJudged(t *testing.T) { // 1898 K1, ADR 0535 §5
|
||||||
|
t.Parallel()
|
||||||
m, states, ws, _ := workspaceFor(t, "slow")
|
m, states, ws, _ := workspaceFor(t, "slow")
|
||||||
for _, runner := range []any{nil, RunnerInstalled} {
|
for _, runner := range []any{nil, RunnerInstalled} {
|
||||||
args := map[string]any{"workspace": ws, "level": LevelUnit}
|
args := map[string]any{"workspace": ws, "level": LevelUnit}
|
||||||
@@ -223,6 +224,7 @@ func TestAnUnknownRunnerIsRefused(t *testing.T) { // 1898 K1
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTheShutOffProcessRunsTheStepItIsAsked(t *testing.T) { // 1898 K2: the candidate's side of the spec
|
func TestTheShutOffProcessRunsTheStepItIsAsked(t *testing.T) { // 1898 K2: the candidate's side of the spec
|
||||||
|
t.Parallel()
|
||||||
m, _, ws, calls := workspaceFor(t, "slow")
|
m, _, ws, calls := workspaceFor(t, "slow")
|
||||||
m.Inside = true
|
m.Inside = true
|
||||||
a := m.answer(context.Background(), levelSpec{Step: stepUnit, Workspace: ws, Packages: []string{"./..."}, Bound: UnitBound})
|
a := m.answer(context.Background(), levelSpec{Step: stepUnit, Workspace: ws, Packages: []string{"./..."}, Bound: UnitBound})
|
||||||
|
|||||||
@@ -24,70 +24,7 @@ import (
|
|||||||
"git.novox.be/novox/mesh-sdk/go/testbus"
|
"git.novox.be/novox/mesh-sdk/go/testbus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nodeEngineTree is the node-engine's repository as the checker places it beside this check (MESH_CHECK_BESIDE, the
|
// copyHostTree copies the files of a source tree into dst, leaving out its .git.
|
||||||
// repository mesh-host), and with it every Go module of the other repositories placed there (mesh-sdk, mesh-contracts,
|
|
||||||
// mesh-delivery, mesh-networking, the catalogue's trunk) and of the catalogue under check, first, as candidates: the workspace lays those the
|
|
||||||
// node-engine's composer requires at the zero version, transitively (workspaceOf), so they resolve as the group lays
|
|
||||||
// them, wherever the composer lives. The test
|
|
||||||
// builds the node-engine's real composer command from that tree; it does not stand one in. With no beside directory it
|
|
||||||
// fails, and with the node-engine beside but no composer command in it it fails: a composer test that could not build its
|
|
||||||
// composer proves nothing. With a beside directory that holds no node-engine at all it skips aloud (NOT JUDGED), since a
|
|
||||||
// checker from before this release places none for the catalogue.
|
|
||||||
func nodeEngineTree(t *testing.T) (tree string, modules []string) {
|
|
||||||
t.Helper()
|
|
||||||
beside := os.Getenv("MESH_CHECK_BESIDE")
|
|
||||||
if beside == "" {
|
|
||||||
t.Fatal("NOT CHECKED: MESH_CHECK_BESIDE is not set, so the node-engine's repository (mesh-host) is not beside this check")
|
|
||||||
}
|
|
||||||
tree = filepath.Join(beside, "mesh-host")
|
|
||||||
if !dirExists(tree) {
|
|
||||||
// A checker from before novox/hq ADR 0593 places only mesh-sdk beside a catalogue check, so the node-engine's
|
|
||||||
// repository is absent, not wrong: said aloud, since nothing here could build a composer to judge.
|
|
||||||
t.Skipf("NOT JUDGED: the node-engine's repository (mesh-host) is not beside this check in MESH_CHECK_BESIDE=%s; the running checker places none for the catalogue, so the composer is judged only once it does", beside)
|
|
||||||
}
|
|
||||||
if _, err := os.Stat(filepath.Join(tree, "cmd", "mesh-compose")); err != nil {
|
|
||||||
t.Fatalf("NOT CHECKED: the node-engine's composer command is not beside this check in MESH_CHECK_BESIDE=%s: %v", beside, err)
|
|
||||||
}
|
|
||||||
entries, err := os.ReadDir(beside)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
var roots []string
|
|
||||||
for _, e := range entries {
|
|
||||||
if e.Name() == "mesh-host" || !dirExists(filepath.Join(beside, e.Name())) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
root, err := filepath.EvalSymlinks(filepath.Join(beside, e.Name()))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
roots = append(roots, root)
|
|
||||||
}
|
|
||||||
// The catalogue under check, first: beside lies its trunk (issue 1295), whose modules a head's must win over.
|
|
||||||
catalogue, err := filepath.Abs(filepath.Join("..", "..", "..", ".."))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, root := range append([]string{catalogue}, roots...) {
|
|
||||||
filepath.WalkDir(root, func(p string, d fs.DirEntry, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if d.IsDir() && (d.Name() == ".git" || d.Name() == "testdata" || d.Name() == "node_modules") {
|
|
||||||
return filepath.SkipDir
|
|
||||||
}
|
|
||||||
if !d.IsDir() && d.Name() == "go.mod" {
|
|
||||||
modules = append(modules, filepath.Dir(p))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return tree, modules
|
|
||||||
}
|
|
||||||
|
|
||||||
func dirExists(p string) bool { st, err := os.Stat(p); return err == nil && st.IsDir() }
|
|
||||||
|
|
||||||
// copyTree copies the files of a source tree into dst, leaving out its .git.
|
|
||||||
func copyHostTree(t *testing.T, src, dst string) {
|
func copyHostTree(t *testing.T, src, dst string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
src, err := filepath.EvalSymlinks(src)
|
src, err := filepath.EvalSymlinks(src)
|
||||||
@@ -130,7 +67,7 @@ func goEnvOf(t *testing.T, name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1622/AC1, AC3 against the real bus (ADR 0593 §7, C9): a compose ask put on the Go build seat's check stream is pulled by
|
// 1622/AC1, AC3 against the real bus (ADR 0593 §7, C9): a compose ask put on the Go build seat's check stream is pulled by
|
||||||
// the module started whole on that bus, which fetches the commit (the node-engine's repository beside the check, its Go module at the root), builds the composer command the ask names there with nothing fetched, fills the
|
// the module started whole on that bus, which fetches the commit (a stand-in composer of this module's testdata, its Go module at the root), builds the composer command the ask names there with nothing fetched, fills the
|
||||||
// request's manifests from the indexer's state and runs the composer; the step key <node>.<ask id> passes with the
|
// request's manifests from the indexer's state and runs the composer; the step key <node>.<ask id> passes with the
|
||||||
// composer's verdict. A second ask of the same commit runs the kept composer: fetched and built once.
|
// composer's verdict. A second ask of the same commit runs the kept composer: fetched and built once.
|
||||||
func TestAComposeAskIsBuiltOnceAndAnsweredOnTheBus(t *testing.T) {
|
func TestAComposeAskIsBuiltOnceAndAnsweredOnTheBus(t *testing.T) {
|
||||||
@@ -157,14 +94,11 @@ func TestAComposeAskIsBuiltOnceAndAnsweredOnTheBus(t *testing.T) {
|
|||||||
m.Run = StepRunner(t.TempDir())
|
m.Run = StepRunner(t.TempDir())
|
||||||
m.GoModCache = goEnvOf(t, "GOMODCACHE") // the module cache this module's own build filled, read and not fetched
|
m.GoModCache = goEnvOf(t, "GOMODCACHE") // the module cache this module's own build filled, read and not fetched
|
||||||
run, gocache := m.Run, goEnvOf(t, "GOCACHE") // this machine's build cache, so the composer's packages compile once
|
run, gocache := m.Run, goEnvOf(t, "GOCACHE") // this machine's build cache, so the composer's packages compile once
|
||||||
hostTree, beside := nodeEngineTree(t)
|
// The composer is a stand-in of this module's own testdata (design 47 G A-474: a module's tests read nothing outside it, and a
|
||||||
workFile := ""
|
// pipeline's step places no other repository beside the tree): a program of the composer's contract that imports nothing.
|
||||||
|
hostTree := filepath.Join("testdata", "composer")
|
||||||
m.Run = func(ctx context.Context, env []string, name string, args ...string) forgekey.Ran {
|
m.Run = func(ctx context.Context, env []string, name string, args ...string) forgekey.Ran {
|
||||||
env = append(env, "GOCACHE="+gocache)
|
return run(ctx, append(env, "GOCACHE="+gocache), name, args...)
|
||||||
if workFile != "" {
|
|
||||||
env = append(env, "GOWORK="+workFile, "GOFLAGS=-mod=readonly") // a workspace takes no -mod=mod
|
|
||||||
}
|
|
||||||
return run(ctx, env, name, args...)
|
|
||||||
}
|
}
|
||||||
read, digests := catalogHolds(t, `{"module":"demo","version":"1"}`)
|
read, digests := catalogHolds(t, `{"module":"demo","version":"1"}`)
|
||||||
m.ReadEntry = read
|
m.ReadEntry = read
|
||||||
@@ -181,18 +115,6 @@ func TestAComposeAskIsBuiltOnceAndAnsweredOnTheBus(t *testing.T) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
copyHostTree(t, hostTree, tree)
|
copyHostTree(t, hostTree, tree)
|
||||||
if len(beside) > 0 { // the group's other repositories, laid beside the node-engine's tree as one workspace
|
|
||||||
work, err := workspaceOf(tree, beside)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := os.WriteFile(filepath.Join(m.Work, ws, "go.work"), []byte(work), 0o600); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
workFile = filepath.Join(m.Work, ws, "go.work")
|
|
||||||
// Nothing is downloaded here: this level has no network. The check's own fetch downloaded this workspace's
|
|
||||||
// graph (downloadBeside), and a module it lacks fails the build naming it.
|
|
||||||
}
|
|
||||||
return map[string]any{"workspace": ws}, nil
|
return map[string]any{"workspace": ws}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +125,7 @@ func TestAComposeAskIsBuiltOnceAndAnsweredOnTheBus(t *testing.T) {
|
|||||||
|
|
||||||
ask := func() sdkstep.Step {
|
ask := func() sdkstep.Step {
|
||||||
a := composeAskOf(t, digests[0])
|
a := composeAskOf(t, digests[0])
|
||||||
a.Compose.Fetch.Repository, a.Compose.Dir, a.Compose.Package = "novox/mesh-host", catalogclient.RootPath, "github.com/novox/mesh-host/cmd/mesh-compose"
|
a.Compose.Fetch.Repository, a.Compose.Dir, a.Compose.Package = "novox/mesh-catalog", catalogclient.RootPath, "standin/cmd/mesh-compose"
|
||||||
raw, err := sdkstep.EncodeStepAsk(a)
|
raw, err := sdkstep.EncodeStepAsk(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ func TestAPackageWithTheReadsOutsideMarkerIsKeptOnlyByWhatItLists(t *testing.T)
|
|||||||
}
|
}
|
||||||
edit(t, tree, "docs/one.md", "one\n")
|
edit(t, tree, "docs/one.md", "one\n")
|
||||||
edit(t, tree, "other.md", "other\n")
|
edit(t, tree, "other.md", "other\n")
|
||||||
|
// Each marker is judged in a fixture of its own, side by side: the digests are go commands, and the table is the test's longest part.
|
||||||
for name, marker := range map[string]string{
|
for name, marker := range map[string]string{
|
||||||
"an empty marker": "# nothing listed\n\n",
|
"an empty marker": "# nothing listed\n\n",
|
||||||
"a sentence": "the tests read ../docs\n",
|
"a sentence": "the tests read ../docs\n",
|
||||||
@@ -282,19 +283,44 @@ func TestAPackageWithTheReadsOutsideMarkerIsKeptOnlyByWhatItLists(t *testing.T)
|
|||||||
"a path that is not clean": "docs/./one.md\n",
|
"a path that is not clean": "docs/./one.md\n",
|
||||||
"a good line and a bad line": "docs\nnope/*.md\n",
|
"a good line and a bad line": "docs\nnope/*.md\n",
|
||||||
} {
|
} {
|
||||||
edit(t, tree, "c/"+ReadsOutsideMarker, marker)
|
t.Run(name, func(t *testing.T) {
|
||||||
first, second := digests(t, m, "unit"), digests(t, m, "unit")
|
t.Parallel()
|
||||||
if len(first.Packages[c]) != 64 || first.Packages[c] == second.Packages[c] || first.Packages[c] == plain.Packages[c] {
|
m, tree := digestFixture(t)
|
||||||
t.Errorf("%s: c's digest is stable: %s, %s, before %s", name, first.Packages[c], second.Packages[c], plain.Packages[c])
|
plain := digests(t, m, "unit")
|
||||||
}
|
if err := os.MkdirAll(filepath.Join(tree, "docs"), 0o755); err != nil {
|
||||||
if strings.Join(first.ReadsOutside, ",") != c {
|
t.Fatal(err)
|
||||||
t.Errorf("%s: the answer does not name the package that reads outside: %v", name, first.ReadsOutside)
|
}
|
||||||
}
|
edit(t, tree, "docs/one.md", "one\n")
|
||||||
if first.Packages[a] != plain.Packages[a] || first.Packages[a] != second.Packages[a] {
|
edit(t, tree, "other.md", "other\n")
|
||||||
t.Errorf("%s: a has no marker and its digest moved: %s, %s, before %s", name, first.Packages[a], second.Packages[a], plain.Packages[a])
|
edit(t, tree, "c/"+ReadsOutsideMarker, marker)
|
||||||
}
|
first, second := digests(t, m, "unit"), digests(t, m, "unit")
|
||||||
|
if len(first.Packages[c]) != 64 || first.Packages[c] == second.Packages[c] || first.Packages[c] == plain.Packages[c] {
|
||||||
|
t.Errorf("%s: c's digest is stable: %s, %s, before %s", name, first.Packages[c], second.Packages[c], plain.Packages[c])
|
||||||
|
}
|
||||||
|
if strings.Join(first.ReadsOutside, ",") != c {
|
||||||
|
t.Errorf("%s: the answer does not name the package that reads outside: %v", name, first.ReadsOutside)
|
||||||
|
}
|
||||||
|
if first.Packages[a] != plain.Packages[a] || first.Packages[a] != second.Packages[a] {
|
||||||
|
t.Errorf("%s: a has no marker and its digest moved: %s, %s, before %s", name, first.Packages[a], second.Packages[a], plain.Packages[a])
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// The marker that lists what the package's tests read, and the marker of what the package needs (issue 890/AC3): in a fixture of its
|
||||||
|
// own, so it runs beside the table above.
|
||||||
|
func TestAListedReadsOutsideMarkerKeepsTheDigestOfOnlyWhatItLists(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
m, tree := digestFixture(t)
|
||||||
|
plain := digests(t, m, "unit")
|
||||||
|
c, a := "fixture/digest/c", "fixture/digest/a"
|
||||||
|
if err := os.MkdirAll(filepath.Join(tree, "docs"), 0o755); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
edit(t, tree, "docs/one.md", "one\n")
|
||||||
|
edit(t, tree, "other.md", "other\n")
|
||||||
|
|
||||||
// A list: a glob, a directory read whole, and a path whose absence is read.
|
// A list: a glob, a directory read whole, and a path whose absence is read.
|
||||||
edit(t, tree, "c/"+ReadsOutsideMarker, "# what c's tests read\ndocs/*.md\ndocs\n?gone\n")
|
edit(t, tree, "c/"+ReadsOutsideMarker, "# what c's tests read\ndocs/*.md\ndocs\n?gone\n")
|
||||||
before := digests(t, m, "unit")
|
before := digests(t, m, "unit")
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ func TestABuildRunsShutOffAndOnlyATrunkBuildWritesTheCaches(t *testing.T) {
|
|||||||
|
|
||||||
// 1309-S3: the digest's go list runs shut off.
|
// 1309-S3: the digest's go list runs shut off.
|
||||||
func TestTheDigestListsPackagesShutOff(t *testing.T) {
|
func TestTheDigestListsPackagesShutOff(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
m, _ := digestFixture(t)
|
m, _ := digestFixture(t)
|
||||||
var seen []shutOff
|
var seen []shutOff
|
||||||
m.Run = throughBubblewrap(t, m.Run, &seen)
|
m.Run = throughBubblewrap(t, m.Run, &seen)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
// resolves no name, reaches no socket of the machine (a TCP port on its loopback, a unix socket) and leaves the shared
|
// resolves no name, reaches no socket of the machine (a TCP port on its loopback, a unix socket) and leaves the shared
|
||||||
// caches unchanged. The probe is testdata/repos/probe.
|
// caches unchanged. The probe is testdata/repos/probe.
|
||||||
func TestARunStepReachesNoKeyLoginNameOrSocketAndLeavesTheCachesUnchanged(t *testing.T) {
|
func TestARunStepReachesNoKeyLoginNameOrSocketAndLeavesTheCachesUnchanged(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the shut-off unit level", "go", "git", "bwrap")
|
needTools(t, "the shut-off unit level", "go", "git", "bwrap")
|
||||||
tree := repository(t, "probe")
|
tree := repository(t, "probe")
|
||||||
work, err := os.MkdirTemp("", "w")
|
work, err := os.MkdirTemp("", "w")
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ func sleepABit() { time.Sleep(30 * time.Millisecond) }
|
|||||||
// The workspace is self-contained after the fetch: no alternates file, and git finds the commit with the mirror gone,
|
// The workspace is self-contained after the fetch: no alternates file, and git finds the commit with the mirror gone,
|
||||||
// as a step shut off with the workspace alone needs. Real git, a local repository as the forge.
|
// as a step shut off with the workspace alone needs. Real git, a local repository as the forge.
|
||||||
func TestTheWorkspaceIsSelfContainedAfterAFetchThroughTheMirror(t *testing.T) {
|
func TestTheWorkspaceIsSelfContainedAfterAFetchThroughTheMirror(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
if _, err := exec.LookPath("git"); err != nil {
|
if _, err := exec.LookPath("git"); err != nil {
|
||||||
t.Skip("no git")
|
t.Skip("no git")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
// build_go_fetch is asked that head as the package's version and build_go_build runs on the member, then both pass, the
|
// build_go_fetch is asked that head as the package's version and build_go_build runs on the member, then both pass, the
|
||||||
// build with GOPROXY=off against the head: the older commit holds no Go package at all.
|
// build with GOPROXY=off against the head: the older commit holds no Go package at all.
|
||||||
func TestRealFetchAndBuildOfAMemberAskedAPullHeadItsGoModDoesNotName(t *testing.T) {
|
func TestRealFetchAndBuildOfAMemberAskedAPullHeadItsGoModDoesNotName(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// Not skipped when a tool is missing: a pass of the check must mean this test ran (the check prints no test log).
|
// Not skipped when a tool is missing: a pass of the check must mean this test ran (the check prints no test log).
|
||||||
for _, tool := range []string{"go", "git"} {
|
for _, tool := range []string{"go", "git"} {
|
||||||
if _, err := exec.LookPath(tool); err != nil {
|
if _, err := exec.LookPath(tool); err != nil {
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ func TestARelativeReplaceStillResolvesInTheTemporaryModfile(t *testing.T) {
|
|||||||
// the asked versions, else from the trunk's latest published version, and never looked for as the commit 000000000000
|
// the asked versions, else from the trunk's latest published version, and never looked for as the commit 000000000000
|
||||||
// among the pull request heads.
|
// among the pull request heads.
|
||||||
func TestARequirementAtTheZeroVersionIsTakenFromTheAskOrTheTrunk(t *testing.T) {
|
func TestARequirementAtTheZeroVersionIsTakenFromTheAskOrTheTrunk(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
const sdk = "git.novox.be/novox/mesh-sdk/go"
|
const sdk = "git.novox.be/novox/mesh-sdk/go"
|
||||||
zeroMod := "module fixture/member\n\ngo 1.26\n\nrequire (\n\t" + sdk + " v0.0.0-00010101000000-" + zeroShort + "\n)\n"
|
zeroMod := "module fixture/member\n\ngo 1.26\n\nrequire (\n\t" + sdk + " v0.0.0-00010101000000-" + zeroShort + "\n)\n"
|
||||||
trunk := strings.Repeat("a", 40)
|
trunk := strings.Repeat("a", 40)
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ func TestRealFetchMergesConflictsAndPlainlyFetches(t *testing.T) {
|
|||||||
// sibling and passes with it; the sibling is a plain directory with no symlink in it; and a sibling that holds a
|
// sibling and passes with it; the sibling is a plain directory with no symlink in it; and a sibling that holds a
|
||||||
// symlink fails the fetch naming it.
|
// symlink fails the fetch naming it.
|
||||||
func TestRealTestsReadTheSiblingBesideTheTree(t *testing.T) {
|
func TestRealTestsReadTheSiblingBesideTheTree(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the shut-off unit level", "go", "git", "bwrap") // the tests run in bubblewrap (1309)
|
needTools(t, "the shut-off unit level", "go", "git", "bwrap") // the tests run in bubblewrap (1309)
|
||||||
f := newForge(t)
|
f := newForge(t)
|
||||||
files := map[string]string{}
|
files := map[string]string{}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ func resolve(t *testing.T, addr string, a builds.BuiltArtifact) []byte {
|
|||||||
// reference resolves in a real artifact store to bytes of that digest. The build is the real go's, shut off, of the
|
// reference resolves in a real artifact store to bytes of that digest. The build is the real go's, shut off, of the
|
||||||
// fixture testdata/repos/build, with an archive beside its bundle.
|
// fixture testdata/repos/build, with an archive beside its bundle.
|
||||||
func TestADoneBuildsArtifactsResolveInARealArtifactStore(t *testing.T) {
|
func TestADoneBuildsArtifactsResolveInARealArtifactStore(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the build", "go", "bwrap")
|
needTools(t, "the build", "go", "bwrap")
|
||||||
work := t.TempDir()
|
work := t.TempDir()
|
||||||
tree := filepath.Join(work, "ws1", "tree")
|
tree := filepath.Join(work, "ws1", "tree")
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ func repository(t *testing.T, name string) string {
|
|||||||
// test_test.go read the output captured from them, and this one proves the capture is what the real go says today. It
|
// test_test.go read the output captured from them, and this one proves the capture is what the real go says today. It
|
||||||
// starts go test, so it carries the tag.
|
// starts go test, so it carries the tag.
|
||||||
func TestUnitLevelRunsTheRealGoOnTheFixtureRepositories(t *testing.T) {
|
func TestUnitLevelRunsTheRealGoOnTheFixtureRepositories(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the unit level on fixtures", "go", "git", "bwrap")
|
needTools(t, "the unit level on fixtures", "go", "git", "bwrap")
|
||||||
want := map[string]struct {
|
want := map[string]struct {
|
||||||
passed, noTests bool
|
passed, noTests bool
|
||||||
@@ -104,6 +105,7 @@ func TestUnitLevelRunsTheRealGoOnTheFixtureRepositories(t *testing.T) {
|
|||||||
// 086 A-C3 against the real go (design 47 line 571 at b229f5c4): a tree holding an unformatted file passes its unit
|
// 086 A-C3 against the real go (design 47 line 571 at b229f5c4): a tree holding an unformatted file passes its unit
|
||||||
// level, its two tests run, and the lint step's body fails naming the file.
|
// level, its two tests run, and the lint step's body fails naming the file.
|
||||||
func TestAnUnformattedFileFailsTheRealLintStepAndNotTheUnitLevel(t *testing.T) {
|
func TestAnUnformattedFileFailsTheRealLintStepAndNotTheUnitLevel(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the unit level's gofmt and vet", "go", "git", "bwrap")
|
needTools(t, "the unit level's gofmt and vet", "go", "git", "bwrap")
|
||||||
home := t.TempDir()
|
home := t.TempDir()
|
||||||
m := &Module{Home: home, Work: t.TempDir(), Cache: t.TempDir()}
|
m := &Module{Home: home, Work: t.TempDir(), Cache: t.TempDir()}
|
||||||
@@ -150,7 +152,7 @@ func TestIntegrationLevelRunsAgainstARealStoreAndBusAndLeavesNothing(t *testing.
|
|||||||
needTools(t, "the integration level", "go", "git", "initdb", "pg_ctl", "postgres", "bwrap")
|
needTools(t, "the integration level", "go", "git", "initdb", "pg_ctl", "postgres", "bwrap")
|
||||||
tree := repository(t, "store")
|
tree := repository(t, "store")
|
||||||
// A short work directory: a unix socket's path is bounded at 108 bytes.
|
// A short work directory: a unix socket's path is bounded at 108 bytes.
|
||||||
work, err := os.MkdirTemp("/tmp", "w")
|
work, err := os.MkdirTemp(os.TempDir(), "w")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -185,6 +187,7 @@ func TestIntegrationLevelRunsAgainstARealStoreAndBusAndLeavesNothing(t *testing.
|
|||||||
// 1487/AC2: given a fixture Go module, when it is built twice, both digests are equal and the archive holds one
|
// 1487/AC2: given a fixture Go module, when it is built twice, both digests are equal and the archive holds one
|
||||||
// executable named as binaryName says. It runs the real go, so it carries the tag.
|
// executable named as binaryName says. It runs the real go, so it carries the tag.
|
||||||
func TestBuildTwiceGivesOneDigestAndOneExecutable(t *testing.T) {
|
func TestBuildTwiceGivesOneDigestAndOneExecutable(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
needTools(t, "the build", "go", "bwrap")
|
needTools(t, "the build", "go", "bwrap")
|
||||||
work := t.TempDir()
|
work := t.TempDir()
|
||||||
tree := filepath.Join(work, "ws1", "tree")
|
tree := filepath.Join(work, "ws1", "tree")
|
||||||
|
|||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
// Command mesh-compose is the stand-in composer the compose ask's test builds: a program of the contract the Go build module
|
||||||
|
// runs (`-request <file>`, the last line of its standard output a composer verdict of version 1), which judges nothing and
|
||||||
|
// answers each case of the request by its name, with no manifest and no machine. It imports nothing of the mesh.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
file := flag.String("request", "", "the request file")
|
||||||
|
flag.Parse()
|
||||||
|
raw, err := os.ReadFile(*file)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
var req struct {
|
||||||
|
Cases []struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
} `json:"cases"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(raw, &req); err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
type verdict struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Manifests map[string]any `json:"manifests"`
|
||||||
|
}
|
||||||
|
out := struct {
|
||||||
|
V int `json:"v"`
|
||||||
|
SDK string `json:"sdk"`
|
||||||
|
Cases []verdict `json:"cases"`
|
||||||
|
}{V: 1, SDK: "stand-in"}
|
||||||
|
for _, c := range req.Cases {
|
||||||
|
out.Cases = append(out.Cases, verdict{Name: c.Name, Manifests: map[string]any{}})
|
||||||
|
}
|
||||||
|
line, _ := json.Marshal(out)
|
||||||
|
fmt.Println(string(line))
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
module standin
|
||||||
|
|
||||||
|
go 1.26
|
||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
// group's head Go cannot fetch is placed from the forge's pull request heads; a go.mod that does not require the package
|
// group's head Go cannot fetch is placed from the forge's pull request heads; a go.mod that does not require the package
|
||||||
// takes nothing.
|
// takes nothing.
|
||||||
func TestAnAskedVersionIsWrittenIntoTheModfileWhateverGoModNames(t *testing.T) {
|
func TestAnAskedVersionIsWrittenIntoTheModfileWhateverGoModNames(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
const sdk = "git.novox.be/novox/mesh-sdk/go"
|
const sdk = "git.novox.be/novox/mesh-sdk/go"
|
||||||
trunk := strings.Repeat("a", 40)
|
trunk := strings.Repeat("a", 40)
|
||||||
offHead := strings.Repeat("b", 40) // a commit no pull request's head carries
|
offHead := strings.Repeat("b", 40) // a commit no pull request's head carries
|
||||||
|
|||||||
Reference in New Issue
Block a user