Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion .github/workflows/mcpx-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,65 @@ jobs:
docker logs mcpx-remote-daemon >&2
exit 1

remote-e2e:
name: "environment: mcpx remote daemon e2e subset"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: pkgs/mcpx/go.mod
cache: true
cache-dependency-path: pkgs/mcpx/go.sum
- uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23
- uses: DeterminateSystems/magic-nix-cache-action@84c0677f58dcedf3b91f8223ce36a9ea5b3c84b7 # v15
continue-on-error: true
with:
use-flakehub: false
use-gha-cache: true
- name: Build the shipped image
run: nix build .#packages.x86_64-linux.mcpx-container --print-build-logs --out-link mcpx-image
- name: Run the remote-safe e2e subset against the image daemon
working-directory: pkgs/mcpx
env:
MCPX_DAEMON_ENDPOINT: http://127.0.0.1:18765
run: |
set -euo pipefail
image=$(docker load --input ../../mcpx-image | sed -n 's/^Loaded image: //p')
test -n "$image"
trap 'docker rm -f mcpx-remote-e2e-daemon >/dev/null 2>&1 || true' EXIT
docker run --detach --name mcpx-remote-e2e-daemon \
--publish 127.0.0.1:18765:18765 \
--env MCPX_DAEMON_ADDRESS=0.0.0.0 \
--env MCPX_DAEMON_PORT=18765 \
"$image" daemon
ready=""
for attempt in $(seq 1 30); do
if docker run --rm --network host \
--env MCPX_DAEMON_ENDPOINT="$MCPX_DAEMON_ENDPOINT" \
"$image" status 2>/dev/null | grep -q 'daemon: running'; then
ready=1
break
fi
sleep 1
done
if [ -z "$ready" ]; then
echo "daemon container did not answer status after $attempt attempts" >&2
docker logs mcpx-remote-e2e-daemon >&2
exit 1
fi
# The subset is exactly the registry: one test name per line in
# remote_safe_tests.txt, comments and blanks ignored. A test
# that is not listed is never started (fail closed, #13386).
pattern=$(grep -v -e '^[[:space:]]*#' -e '^[[:space:]]*$' internal/e2e/remote_safe_tests.txt | paste -sd'|' -)
test -n "$pattern"
MCPX_E2E_REMOTE=1 go test ./internal/e2e/ -run "^(${pattern})$" -count=1 -v

ci-ok:
name: "mcpx-test ci-ok"
needs:
[init, unit, lint, plugin-ts, e2e, nix-e2e, e2e-host-linux-arm64, e2e-no-deno, container-e2e, remote-smoke]
[init, unit, lint, plugin-ts, e2e, nix-e2e, e2e-host-linux-arm64, e2e-no-deno, container-e2e, remote-smoke, remote-e2e]
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
10 changes: 10 additions & 0 deletions pkgs/mcpx/internal/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ type env struct {

func newEnv(t *testing.T, cfgBody string) *env {
t.Helper()
// Remote mode (#13386): the suite runs against a shared daemon the
// test did not start. Selection fails closed — a test that is not in
// remote_safe_tests.txt never gets an env, so a full-suite remote run
// skips it instead of pointing host-local fixtures at the daemon.
if remoteMode() {
if !remoteSafeTest(t.Name()) {
t.Skipf("remote mode: %s is not declared remote-safe in remote_safe_tests.txt", t.Name())
}
return newRemoteEnv(t, cfgBody)
}
// Outside $HOME: the daemon finds scripts and recipes by walking up
// from here, and must not reach the user's own (testsupport.TempDir).
dir := testsupport.TempDir(t)
Expand Down
12 changes: 12 additions & 0 deletions pkgs/mcpx/internal/e2e/remote_safe_tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The remote-safe e2e subset (#13386): one test name per line.
#
# A test named here claims it can run against a shared daemon it did not
# start, reached over MCPX_DAEMON_ENDPOINT: it needs no host-local server
# binary (the FAKE fixture path does not exist on the daemon's host), does
# not stop or restart the daemon, and does not depend on a per-test daemon
# config file. A test that needs a server on the daemon adds it with
# addRemoteServer (POST /v1/servers, per-test suffixed name, removed in
# cleanup). Selection fails closed: a test that is not listed here is
# never run remotely — the CI leg builds its -run pattern from this file
# and newEnv skips unlisted tests when remote mode is on.
TestExecOnTheDaemonRunsWhereTheDaemonIs
Loading