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
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: build
name: lint

on:
pull_request:
branches:
- main
workflow_dispatch:

permissions:
contents: read

jobs:
build:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout
- name: Checkout tests
uses: actions/checkout@v7

- name: Setup Go
uses: actions/setup-go@v7
with:
go-version: "1.27.x"
cache-dependency-path: '**/go.sum'

- name: Verify
run: make verify
- name: Lint
run: make lint
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ vendor/

/cli/bin/*
!/cli/bin/.gitkeep
/mcp/bin/*
!/mcp/bin/.gitkeep
/services/bin/*
!/services/bin/.gitkeep
/services/docker-bin/*
!/services/docker-bin/.gitkeep
/docker/testdata/*
!/docker/testdata/.gitkeep
!/docker/testdata/.gitkeep
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ linters:
linters:
- noctx

- path: ^cli/harness/service\.go$
linters:
- errcheck

- path: ^(cli|docker)/harness/(harness|service)\.go$
linters:
- gosec
Expand Down
113 changes: 53 additions & 60 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,13 @@ export PATH := $(ROOT_PATH)tools/bin:$(PATH)

include $(ROOT_PATH)tools/tools.mk

BUILD_DIR := $(ROOT_PATH)build

CLI_REPO ?= https://github.com/e2engine/cli.git
CLI_REF ?= main

CLI_SRC := $(BUILD_DIR)/cli

GOOS ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
GOARCH ?= $(shell uname -m)
ifeq ($(GOARCH), x86_64)
override GOARCH = amd64
endif

CLI_BIN_NAME := e2engine-$(GOOS)-$(GOARCH)$(shell [ "$(GOOS)" = windows ] && echo .exe)
CLI_BIN := $(ROOT_PATH)cli/bin/cli

.PHONY: build-cli
build-cli:
@echo "Building e2engine-cli..."
@rm -rf $(BUILD_DIR)
@set -e; \
trap 'rm -rf "$(BUILD_DIR)"' EXIT; \
echo "Cloning CLI repository..."; \
git clone $(CLI_REPO) $(CLI_SRC); \
git -C $(CLI_SRC) checkout $(CLI_REF); \
echo "Preparing e2engine-cli module..."; \
cd $(CLI_SRC); \
mkdir -p $(dir $(CLI_BIN)); \
echo "Building $(CLI_BIN_NAME) binary..."; \
$(MAKE) build-cli; \
cp bin/$(CLI_BIN_NAME) $(CLI_BIN)
@echo "$(CLI_BIN) built successfully"
CLI_BIN := $(ROOT_PATH)cli/bin/cli
MCP_BIN := $(ROOT_PATH)mcp/bin/mcp

SERVICES_BIN_PATH ?= $(ROOT_PATH)services/bin

Expand Down Expand Up @@ -81,6 +56,12 @@ build-ok-grpc-service:
@go build -o $(SERVICES_BIN_PATH)/ok-grpc ./services/ok-grpc
@echo "Ok gRPC service built successfully at $(SERVICES_BIN_PATH)/ok-grpc"

.PHONY: build-telemetry-http-service
build-telemetry-http-service:
@echo "Building telemetry HTTP service..."
@go build -o $(SERVICES_BIN_PATH)/telemetry-http ./services/telemetry-http
@echo "Telemetry HTTP service built successfully at $(SERVICES_BIN_PATH)/telemetry-http"

.PHONY: protoc-ok-service
protoc-ok-service:
@echo "Generating protobuf code for ok service..."
Expand All @@ -92,24 +73,6 @@ protoc-ok-service:
services/ok-grpc/ok.proto
@echo "Protobuf code generated successfully for ok service."

.PHONY: build-image
build-image:
@echo "Checking Docker availability..."
@docker info >/dev/null 2>&1 || (echo "Docker is not available" && exit 1)
@echo "Building e2engine Docker image..."
@rm -rf $(BUILD_DIR)
@set -e; \
trap 'rm -rf "$(BUILD_DIR)"' EXIT; \
echo "Cloning CLI repository..."; \
git clone $(CLI_REPO) $(CLI_SRC); \
git -C $(CLI_SRC) checkout $(CLI_REF); \
echo "Preparing e2engine-cli module..."; \
cd $(CLI_SRC); \
echo "Building e2engine Docker image..."; \
$(MAKE) build-image
@echo "e2engine:local image built successfully"


DOCKER_SERVICES_BIN_PATH := $(ROOT_PATH)services/docker-bin

.PHONY: build-ok-http-image
Expand All @@ -129,41 +92,71 @@ build-ok-http-image:
services
@echo "ok-http image built successfully"

.PHONY: build-telemetry-http-image
build-telemetry-http-image:
@CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build \
-o $(DOCKER_SERVICES_BIN_PATH)/telemetry-http ./services/telemetry-http
@docker buildx build \
--platform linux/$(GOARCH) \
--load \
--build-arg SERVICE=telemetry-http \
-t e2engine-test-telemetry-http:local \
-f services/Dockerfile \
services


.PHONY: lint
lint: install-golangci-lint
@echo "Running linter..."
$(GOLANGCI_LINT) run

.PHONY: vulncheck
vulncheck: install-govulncheck
@echo "Checking for known vulnerabilities..."
$(GOVULNCHECK) ./...

.PHONY: build
build: build-cli \
build-gateway-http-path-service \
build: build-gateway-http-path-service \
build-gateway-http-body-service \
build-gateway-grpc-message-service \
build-gateway-grpc-method-service \
build-ok-http-service \
build-ok-grpc-service \
build-image \
build-ok-http-image
@echo "All test binaries and images built successfully."
build-telemetry-http-service \
build-ok-http-image \
build-telemetry-http-image
@echo "All test helper binaries and images built successfully."

.PHONY: verify
verify: lint build
verify: lint vulncheck test-cli-prebuilt test-docker-prebuilt test-mcp-prebuilt
@echo "All verifications passed successfully."

.PHONY: test-cli
test-cli: build-cli \
build-gateway-http-path-service \
.PHONY: test-cli-prebuilt
test-cli-prebuilt: build-gateway-http-path-service \
build-gateway-http-body-service \
build-gateway-grpc-message-service \
build-gateway-grpc-method-service \
build-ok-http-service \
build-ok-grpc-service
@echo "Running CLI tests..."
build-ok-grpc-service \
build-telemetry-http-service
@test -x $(CLI_BIN) || { echo "Prebuilt CLI binary not found or not executable: $(CLI_BIN)"; exit 1; }
@echo "Running CLI tests with prebuilt binary..."
@go test ./cli/... -count=1

.PHONY: test-docker
test-docker: build-image \
build-ok-http-image
@echo "Running tests with Docker image..."
.PHONY: check-cli-image
check-cli-image:
@docker image inspect e2engine:local >/dev/null 2>&1 || { echo "Prebuilt CLI Docker image not found: e2engine:local"; exit 1; }

.PHONY: test-docker-prebuilt
test-docker-prebuilt: check-cli-image \
build-ok-http-image \
build-telemetry-http-image
@echo "Running tests with prebuilt Docker image..."
@go test ./docker/... -count=1

.PHONY: test-mcp-prebuilt
test-mcp-prebuilt: export GOFLAGS=-mod=mod
test-mcp-prebuilt: build-telemetry-http-service
@test -x $(MCP_BIN) || { echo "Prebuilt MCP binary not found or not executable: $(MCP_BIN)"; exit 1; }
@echo "Running MCP tests with prebuilt binary..."
@go test ./mcp/... -count=1
65 changes: 39 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ End-to-end test suite for E2Engine.

Part of [E2Engine](https://e2engine.dev), an open-source platform for declarative end-to-end testing.

This repository verifies E2Engine through its public interfaces using the CLI, Docker, real and mocked HTTP/gRPC services, direct and socket transports, persistence, and asynchronous execution flows.
This repository verifies E2Engine through its public interfaces using the CLI, MCP, Docker, real and mocked HTTP/gRPC services, direct and socket transports, persistence, and asynchronous execution flows.

The CLI, Docker images, and helper service binaries required by the tests are built locally by the Makefile before the corresponding test suites run.
Candidate CLI and MCP binaries and the CLI Docker image are built in their owning repositories. This Makefile builds the test helper services and consumes the candidate artifacts.

## Coverage

Expand All @@ -23,6 +23,8 @@ The CLI, Docker images, and helper service binaries required by the tests are bu
| Real-to-mocked dependencies | Real HTTP/gRPC services calling mocked dependencies with captured calls |
| Call expectations | Required calls, expected call counts, unmatched call parameters, and missing expected dependencies |
| Execution results | Passed, failed, and error terminal states with persisted execution summaries |
| Telemetry | CLI opt-out, installation registration and reuse, authenticated events, outcome mapping, and best-effort failures against a standalone HTTP mock; Docker registration and authenticated event reuse against the mock container |
| MCP | All environment, test, and test-suite tools over stdio: successful operations and application errors, persistence across process restarts, and telemetry behavior |
| Runner lifecycle | Direct execution waits for completion; socket executions run asynchronously and sequentially |
| Docker | CLI execution in containers, mounted configuration and persistent data, mocked HTTP/gRPC execution, and communication with real services over a Docker network |

Expand All @@ -32,40 +34,53 @@ The E2E suite focuses on behavior across component boundaries. Exhaustive field-

```text
cli/ CLI E2E tests, harness, test data, and generated CLI binary
mcp/ MCP E2E tests, stdio harness, and generated MCP binary
docker/ Docker E2E tests, harness, configuration, and test data
services/ Helper HTTP/gRPC services, generated service binaries, and reusable service Dockerfile
services/ Helper HTTP/gRPC services, the telemetry HTTP mock, generated service binaries, and the reusable service Dockerfile
util/ Shared E2E comparison and test utilities
```

Generated binaries are written to cli/bin/ and services/bin/ and are not committed. Docker tests use locally built E2Engine and helper service images.
Candidate binaries are placed in cli/bin/ and mcp/bin/; test helper binaries are written to services/bin/. None is committed. Docker tests use the prebuilt E2Engine image and locally built helper service images.

## Development

Run the CLI E2E test suite:
Build the candidate CLI binary in the CLI checkout, then run the CLI suite:

```bash
make test-cli
make -C ../cli build-cli-e2e E2E_CLI_PATH="$(pwd)/cli/bin/cli"
make test-cli-prebuilt
```

Run the Docker E2E test suite:
Build the candidate Docker image from the same CLI checkout, then run the Docker suite:

```bash
make test-docker
make -C ../cli build-image-e2e
make test-docker-prebuilt
```

Run the linter:
The image target creates `e2engine:local` with the telemetry mock address
`http://telemetry-http:9000`. Docker tests build their own helper service images.

Build the candidate MCP binary in the MCP checkout, then run the MCP suite:

```bash
make lint
make -C ../mcp build-e2e E2E_MCP_PATH="$(pwd)/mcp/bin/mcp"
make test-mcp-prebuilt
```

Run the complete verification suite:
MCP builds with local module replacements need the corresponding sibling
checkouts. The MCP suite uses a standalone telemetry HTTP mock and a temporary
user profile; it does not contact production service.

Run all three suites and the linter after building the candidate artifacts:

```bash
make verify
```

The test targets build the binaries and Docker images required by their respective suites before running the tests.
`make build` builds only the test repository's helper binaries and images.
The prebuilt test targets build their own helper prerequisites and check that
the supplied CLI/MCP binaries or CLI image exist.

## Stable branch

Expand All @@ -76,18 +91,22 @@ Downstream CI, such as the CLI build, should use `stable` rather than `main`. Th
Changes are promoted in the following order:

1. Update dependencies and tests on `main`.
2. Run the complete test repository CI and ensure it passes.
2. Build candidate CLI and MCP binaries and the CLI image locally, then run
`make verify`. Ensure the tests repository lint CI passes.
3. Promote `main` to `stable`:

```bash
git switch main
git pull --ff-only

# after main CI is green
# after local E2E verification and main lint CI are green
git push origin main:stable
```

The `stable` branch must always point to a commit from main that has already passed CI; promotion should only fast-forward the branch and must not create new commits.
The `stable` branch must always point to a commit from main that has passed
lint CI and local E2E verification. Promotion should only fast-forward the
branch and must not create new commits. CLI and MCP CI build their own
candidate artifacts and run the corresponding prebuilt suites from `stable`.

4. Update downstream repositories that depend on the new versions.

Expand All @@ -105,18 +124,12 @@ tests/stable
downstream repository update
```

## E2Engine

This repository is part of E2Engine.
## Links

- [core](https://github.com/e2engine/core) — core domain model, execution logic, and public APIs
- [repository](https://github.com/e2engine/repository) — persistence implementations
- [runner-local](https://github.com/e2engine/runner-local) — local test execution
- [cli](https://github.com/e2engine/cli) — command-line interface
- [tests](https://github.com/e2engine/tests) — end-to-end tests for E2Engine
- [demo](https://github.com/e2engine/demo) — executable demonstration system and E2Engine usage examples
- [instrumentation-go](https://github.com/e2engine/instrumentation-go) — Go instrumentation library for E2Engine
- [E2Engine website](https://e2engine.dev)
- [E2Engine documentation](https://e2engine.dev/docs)
- [E2Engine on GitHub](https://github.com/e2engine)

## License

Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE).
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE).
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
- id: minimal-mocked-called-at-least-once
kind: http
mode: mocked
address: 127.0.0.1:8083
e2engine_port: 8083
fixtures:
- when:
http:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
- id: spelled-correctly
kind: http
mode: mocked
address: 127.0.0.1:8083
e2engine_port: 8083
fixtures:
- when:
http:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
- id: called
kind: http
mode: mocked
address: 127.0.0.1:8082
e2engine_port: 8082
fixtures:
- when:
http:
Expand All @@ -20,7 +20,7 @@ spec:
- id: not-called
kind: http
mode: mocked
address: 127.0.0.1:8083
e2engine_port: 8083
fixtures:
- when:
http:
Expand Down
Loading