test(workflow-tengo): e2e coverage for running a command in a 10k-file workdir - #1792
test(workflow-tengo): e2e coverage for running a command in a 10k-file workdir#1792DenKoren wants to merge 1 commit into
Conversation
Platforma 4.3.2 fixed k8s jobs that failed to start when the working directory held more than ~7300 files: the runner passed the expected- workdir-item list to the job inline, and above that count `execve` returned E2BIG before the container started. The list now goes to the job by path (`.pl/expected_items`). That fix shipped with unit coverage only (`core/pl/util/k8s/template_test.go`). The defect itself was found by hand during release validation, so add the end-to-end case: a template that fills the working directory with 10000 one-byte files through `exec.builder().writeFile` and then runs `hello-world` in it, plus a test that asserts the command's stdout. `hello-world` has both a binary and a docker distribution, so the same test covers the local exec runner (monorepo-localfs) and the k8s runner (monorepo-k8s-s3, once that job re-adds the workflow-tengo filter).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1792 +/- ##
=======================================
Coverage 53.03% 53.03%
=======================================
Files 414 414
Lines 21347 21347
Branches 4762 4762
=======================================
Hits 11321 11321
Misses 8662 8662
Partials 1364 1364 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What
Adds an end-to-end test that runs a command in a working directory holding 10000 files.
tests/workflow-tengo/src/exec/run/large_workdir.tpl.tengo— fills the workdir with 10000 one-byte files throughexec.builder().writeFilein a loop, then runshello-worldin it and saves stdout.tests/workflow-tengo/src/exec/large-workdir.test.ts— renders the template and asserts the stdout.Why
Platforma 4.3.2 fixed: "K8s jobs no longer fail to start when the working directory holds more than ~7300 files; the workdir item list is passed to the job by path". Before the fix the k8s runner passed the expected-workdir-item list to the job inline; above roughly 7300 entries
execvereturnedE2BIGand the job failed before the container started.ExpectedItems []stringbecameExpectedItemsFileRelativePath string, with the list written to.pl/expected_itemsinside the workdir (util/k8s/job_params.go,DefaultExpectedItemsFileName).The fix shipped with unit coverage only (
core/pl/util/k8s/template_test.go,TestTemplateWithExpectedItemsFile). Nothing anywhere built a real large workdir and ran a command in it — the defect was found by hand during release validation. This test closes that gap.Choices
writeFilerather thanaddFile— no blob, no upload, no signature; just a small value resource per entry.hello-world(@platforma-open/milaboratories.software-test-utils:hello-world) because it has both adockerand abinaryentrypoint (verified insupport/small-binaries/hello-world/package.json), so the same test works under both execution modes.Execution-mode coverage
monorepo-localfsincore/pl/.github/workflows/test.yamlruns--filter=@platforma-sdk/workflow-tengo-testswithPL_PKG_DEV=localon the local exec runner, so this test gets binary coverage now.monorepo-k8s-s3currently excludes that filter (the external software ships no docker image, so the backend fails with"docker is not set"). When the filter returns, the same test gets docker coverage on the k8s runner. Re-adding it is still blocked onsoftware-anarciandsoftware-conda-empty, which that CI comment also names.Do not overread this. The original defect is k8s-specific: the local_exec path has no inline-argv mechanism for the expected-item list. The localfs run is therefore adjacent coverage — large-workdir handling, workdir fill rules, the new
.plservice-dir reservation — not the same defect in a second mode. The defect itself is covered only once the k8s filter is back.Verification
Local backend built from
core/platorigin/release/4.3(60d61697d, reports4.3.2-1-g60d616), local exec runner,PL_PKG_DEV=local, 8-core macOS.ls filler | wc -lin the same workdir: output10000. That template is not committed (it usescmd("/usr/bin/env") bash, which has no docker equivalent).src/execsuite (63 tests) with the new test: 63/63 passed, 3 m 05 s. Baseline without the new test on the same backend: 62/62 passed, 2 m 17 s. Under suite load the new test takes 62–101 s (it shares two vitest workers with the rest).tsc --noEmit) and the package'sfmt(oxlint + oxfmt): clean, no reformatting.changeset status --since=origin/main: no packages to bump. Only@platforma-sdk/workflow-tengo-testschanged, which isprivate: true, and.changeset/config.jsonhasprivatePackages: false— so no changeset entry applies here.Honest caveats:
src/execsuite. Across five runs, timeout-flakiness hit different files each time (writable.test.tstwice,formula.test.tsonce) both with and without the new test; one run was invalid because the local backend was killed mid-run. The two clean back-to-back runs above are the comparison that matters. The new test does add measurable load (~50 s of extra suite wall clock here); CI runners are larger (--runner-local-cpu=12, 24 GiB) and the suite already runs withretry: 2.v4.3.0) behind a real k8s runner; no k8s runner was available in this environment, and the local exec runner cannot exhibit the defect at all. Treat the test as pinning the fixed behaviour, not as demonstrated to have caught the bug.No Notion ticket was supplied, and a search of the workspace found no clear match for this defect, so the branch carries no ticket ID.
Greptile Summary
Adds end-to-end regression coverage that creates a 10,000-file Tengo execution workdir and verifies that
hello-worldstarts and returns the expected stdout. The randomized input prevents backend deduplication from satisfying the test without launching a new execution.exec.builder().writeFile.execveargument or environment payload is too large; the test pins successful execution beyond the former inline-list limit.exec.run.large_workdirto construct and execute the large-workdir scenario.writeFile— An exec-builder operation that stages value-resource content as a workdir file; the fixture invokes it 10,000 times with one-byte values.hello-world— The test software executed in the populated workdir; its stdout proves that the command started and completed.Confidence Score: 5/5
The PR appears safe to merge, with no concrete correctness or security issues identified in the added regression coverage.
The new test and fixture consistently construct the intended large-workdir condition, force a fresh backend execution, and validate successful command completion through stdout.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR T[Vitest creates randomized message] --> R[Render exec.run.large_workdir] R --> W[Stage 10,000 one-byte files] W --> E[Run hello-world in managed workdir] E --> S[Save stdout] S --> A[Assert message and newline]Reviews (1): Last reviewed commit: "test(workflow-tengo): run a command in a..." | Re-trigger Greptile
Context used: