Skip to content

Commit 07972eb

Browse files
authored
Remove handler implementations and restructure project (#2)
Handlers are now expected to be implemented separately (e.g., in binding repos) and pin to a specific release version of this test repository prepared by the added goreleaser CI job. Another CI job is added to run the test runner (previously named as orchestrator) against a mock handler which just echoes the expected response on receiving each request from the test runner.
2 parents 6482638 + 85efd3f commit 07972eb

34 files changed

Lines changed: 341 additions & 1616 deletions

.github/workflows/ci.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.23'
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v6
27+
with:
28+
distribution: goreleaser
29+
version: '~> v2'
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.23'
19+
20+
- name: Build
21+
run: make build
22+
23+
- name: Run tests against mock handler
24+
run: make test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build/

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

.goreleaser.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
project_name: kernel-bindings-tests
2+
3+
builds:
4+
- id: runner
5+
main: ./cmd/runner
6+
binary: runner
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- linux
11+
- darwin
12+
- windows
13+
goarch:
14+
- amd64
15+
- arm64
16+
ignore:
17+
- goos: windows
18+
goarch: arm64
19+
20+
archives:
21+
- id: runner-archive
22+
builds:
23+
- runner
24+
format: tar.gz
25+
format_overrides:
26+
- goos: windows
27+
format: zip
28+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
29+
30+
checksum:
31+
disable: true
32+
33+
changelog:
34+
disable: true
35+
36+
release:
37+
github:
38+
owner: stringintech
39+
name: kernel-bindings-tests
40+
draft: false
41+
prerelease: auto

Makefile

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
.PHONY: all build test test-single clean
1+
.PHONY: all build test clean runner mock-handler deps lint
2+
3+
BUILD_DIR := build
4+
RUNNER_BIN := $(BUILD_DIR)/runner
5+
MOCK_HANDLER_BIN := $(BUILD_DIR)/mock-handler
26

37
all: build test
48

5-
build:
6-
@echo "Building orchestrator binary..."
7-
mkdir -p bin
8-
cd orchestrator && go build -o ./bin/orchestrator
9-
@echo "Building go-handler binary..."
10-
cd go-handler/go-bitcoinkernel && $(MAKE) build-kernel && $(MAKE) build
11-
cd go-handler && go build -o ./bin/go-handler
12-
@echo "Building rust-handler binary..."
13-
cd rust-handler && cargo build --release
14-
@echo "Build complete!"
9+
build: runner mock-handler
1510

16-
test:
17-
@echo "Running all conformance tests with go-handler..."
18-
-./orchestrator/bin/orchestrator -handler ./go-handler/bin/go-handler -testdir testdata
19-
@echo "Running all conformance tests with rust-handler..."
20-
-./orchestrator/bin/orchestrator -handler ./rust-handler/target/release/rust-handler -testdir testdata
11+
runner:
12+
@echo "Building test runner..."
13+
@mkdir -p $(BUILD_DIR)
14+
go build -o $(RUNNER_BIN) ./cmd/runner
2115

22-
test-single:
23-
@if [ -z "$(TEST)" ]; then \
24-
echo "Error: TEST variable not set. Usage: make test-single TEST=testdata/chainstate_basic.json"; \
25-
exit 1; \
26-
fi
27-
@echo "Running test with go-handler: $(TEST)"
28-
./bin/orchestrator -handler ./go-handle/bin/go-handler -testfile $(TEST)
29-
@echo "Running test with rust-handler: $(TEST)"
30-
./bin/orchestrator -handler ./rust-handler/target/release/rust-handler -testfile $(TEST)
16+
mock-handler:
17+
@echo "Building mock handler..."
18+
@mkdir -p $(BUILD_DIR)
19+
go build -o $(MOCK_HANDLER_BIN) ./cmd/mock-handler
20+
21+
test:
22+
@echo "Running conformance tests with mock handler..."
23+
$(RUNNER_BIN) -handler $(MOCK_HANDLER_BIN)
3124

3225
clean:
3326
@echo "Cleaning build artifacts..."
34-
cd go-handler/go-bitcoinkernel && $(MAKE) clean
35-
cd orchestrator && go clean && rm -rf build
36-
cd go-handler && go clean && rm -rf build
37-
cd rust-handler && cargo clean
27+
rm -rf $(BUILD_DIR)

README.md

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Bitcoin Kernel Binding Conformance Tests
22

3-
This directory contains a language-agnostic conformance testing framework for Bitcoin Kernel bindings.
3+
This repository contains a language-agnostic conformance testing framework for Bitcoin Kernel bindings.
44

55
## ⚠️ Work in Progress
66

@@ -15,53 +15,38 @@ The framework ensures that all language bindings (Go, Python, Rust, etc.) behave
1515

1616
```
1717
┌─────────────┐ ┌──────────────────┐
18-
Orchestrator│────────▶│ Handler Binary │
19-
│ (Go Test │ stdin │ (Go/Rust/etc) │
20-
Runner) │◀────────│ │
18+
Test Runner │────────▶│ Handler Binary │
19+
│ (Go CLI) │ stdin │ (Go/Rust/etc) │
20+
│◀────────│ │
2121
└─────────────┘ stdout └──────────────────┘
2222
│ │
2323
│ │
2424
▼ ▼
2525
┌─────────┐ ┌────────────────┐
2626
│ Test │ │ Binding API │
2727
│ Cases │ └────────────────┘
28-
│ (JSON) │
28+
│ (JSON) │
2929
└─────────┘
3030
```
3131

32-
1. [**Orchestrator**](./orchestrator): Spawns handler binary, sends test requests, validates responses
33-
2. **Handler Binary**: Implements protocol, calls binding API, returns results
34-
- [Go handler](./go-handler) for the [Go binding](https://github.com/stringintech/go-bitcoinkernel)
35-
- [Rust handler](./rust-handler) for the [Rust binding](https://github.com/TheCharlatan/rust-bitcoinkernel)
36-
3. [**Test Cases**](./testdata): JSON files defining requests and expected responses
37-
38-
## Getting Started
39-
40-
### Cloning
41-
42-
Clone the repository with submodules:
43-
44-
```bash
45-
git clone --recurse-submodules https://github.com/stringintech/kernel-bindings-spec.git
46-
```
47-
**Note:** go-handler currently depends on go-bitcoinkernel via a submodule.
32+
**This repository contains:**
33+
1. [**Test Runner**](./cmd/runner/main.go): Spawns handler binary, sends test requests via stdin, validates responses from stdout
34+
2. [**Test Cases**](./testdata): JSON files defining requests and expected responses
35+
3. [**Mock Handler**](./cmd/mock-handler/main.go): Validates the runner by echoing expected responses from test cases
4836

37+
**Handler binaries** are not hosted in this repository. They must be implemented separately and should:
38+
- Implement the JSON protocol for communication with the test runner
39+
- Call the binding API to execute operations
40+
- Pin to a specific version/tag of this test repository
4941

50-
### Building
42+
## Getting Started
5143

52-
Use the provided Makefile to build the project:
44+
Build and test against the mock handler:
5345

5446
```bash
55-
# Build everything!
47+
# Build both runner and mock handler
5648
make build
57-
```
58-
59-
### Running Tests
6049

61-
```bash
62-
# Run all conformance tests with both Go and Rust handlers
50+
# Run tests against the mock handler
6351
make test
64-
65-
# Run a specific test file with both Go and Rust handlers
66-
make test-single TEST=testdata/chainstate_basic.json
67-
```
52+
```

0 commit comments

Comments
 (0)