Skip to content

feat(env-setup): test_binaries for spawn-subprocess test deps (redis, nats)#24

Merged
AndriiTsok merged 1 commit intomainfrom
feat/test-services-redis-nats
Apr 18, 2026
Merged

feat(env-setup): test_binaries for spawn-subprocess test deps (redis, nats)#24
AndriiTsok merged 1 commit intomainfrom
feat/test-services-redis-nats

Conversation

@AndriiTsok
Copy link
Copy Markdown
Contributor

Summary

New .environment.yml block:

test_binaries:
  redis: true
  nats: true

Installs the binary onto the runner's PATH so tests that do Command::new("redis-server") / Command::new("nats-server") work. Distinct from the existing services block (docker containers).

Install mechanisms

  • redis: sudo apt-get install redis-server. Service disabled after install so tests control lifecycle.
  • nats: not in apt; fetches the latest stable release tag from github.com/nats-io/nats-server/releases/latest via a redirect HEAD, then downloads the {linux-amd64|linux-arm64}.tar.gz and installs to /usr/local/bin/nats-server. No GitHub token needed.

Adding more binaries later is a small additive change — new boolean under test_binaries, new install step gated on it.

Why now

mcpg-dev/source-code has unit tests in mcpg-plugin-binding-nats that spawn nats-server as a subprocess. Those tests had been silently skipped by the old nx-ci coverage bug; fixing that bug surfaced the missing dependency. This PR is the "install it instead of skip it" side of the user's response.

Plan after merge

Tag v1.4.0, move v1.

🤖 Generated with Claude Code

Adds a new `.environment.yml` field `test_binaries` that installs
external daemon binaries onto the runner's PATH. Distinct from the
existing `services` block which starts docker containers — this is
for tests that spawn and manage the daemon themselves via
Command::new("redis-server") / Command::new("nats-server").

Initial coverage:
  - `test_binaries.redis: true` — `sudo apt-get install redis-server`
    (Linux). Service disabled so tests can control lifecycle.
  - `test_binaries.nats: true` — fetches the latest stable nats-server
    release from github.com/nats-io/nats-server and installs to
    /usr/local/bin/nats-server. Resolves the tag via a HEAD request
    to the /releases/latest URL (no github token needed) and then
    downloads the {arch}.tar.gz asset.

Adding further binaries later is a small additive change — new
boolean under `test_binaries`, new install step gated on it.

Surfaced by mcpg-dev/source-code: mcpg-plugin-binding-nats has unit
tests that spawn nats-server as a subprocess, which had been
silently skipped for weeks by the nx-ci coverage bug. After fixing
that bug, those tests started failing because nats-server isn't on
the runner by default. This closes the loop.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AndriiTsok AndriiTsok merged commit e061b3b into main Apr 18, 2026
6 checks passed
@AndriiTsok AndriiTsok deleted the feat/test-services-redis-nats branch April 18, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant