Skip to content

Add test coverage and fix stale graph references across all SDKs#16

Merged
Nic-dorman merged 6 commits into
mainfrom
feat/sdk-test-coverage
Apr 1, 2026
Merged

Add test coverage and fix stale graph references across all SDKs#16
Nic-dorman merged 6 commits into
mainfrom
feat/sdk-test-coverage

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Summary

  • Add unit tests for Go (6), Python (14), JS/TS (31), and C# (22) REST clients
  • Add integration tests for Go (8), Python (7), JS/TS (8) against live antd daemon
  • Fix stale graph.proto references in Rust SDK, C# SDK, Zig SDK, and Kotlin
  • Fix Rust SDK tests/examples for updated payment_mode parameter
  • Fix Kotlin Gradle build (proto task ordering, JUnit launcher, coroutines dep)
  • Add wallet/signer stubs to C# gRPC client

394 total unit tests + 23 integration tests across 11 SDKs. No SDK has zero coverage.

Test plan

  • Go: 43 pass (35 unit + 8 integration)
  • Python: 50 pass (43 unit + 7 integration)
  • JS/TS: 39 pass (31 unit + 8 integration)
  • Rust: 55 pass
  • C#: 22 pass (xUnit)
  • PHP: 23 pass
  • Dart: 43 pass
  • Ruby: 49 pass
  • Java: 36 pass
  • Kotlin: 7 pass
  • Zig: 27 pass

🤖 Generated with Claude Code

Nic-dorman and others added 6 commits April 1, 2026 19:18
- antd-go: add 6 tests for wallet and external signer methods
  (WalletAddress, WalletBalance, WalletApprove, PrepareUpload,
  PrepareDataUpload, FinalizeUpload) using httptest mock daemon
- antd-py: add 14 tests for REST client using threaded mock HTTP
  server — covers health, data, chunks, wallet, and error mapping
  (404→NotFoundError, 400→BadRequestError, 502→NetworkError)
- antd-js: add 31 vitest tests for REST client with mocked fetch —
  covers all endpoints, error status mapping (7 codes), network
  errors, timeout handling, and constructor options

All tests verified passing: Go 13/13, Python 14/14, JS 31/31.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- antd-rust: remove graph.proto from build.rs, delete dead 05-graph
  example, remove Cargo.toml example entry, update tests and examples
  to pass payment_mode parameter (added in prior commit), fix doctest
- antd-csharp: remove graph.proto from csproj, add wallet and external
  signer stubs to gRPC client (NotSupportedException)

All test suites now pass:
  Go: 35 pass | Python: 43 pass | JS: 31 pass | Rust: 55 pass
  PHP: 23 pass | Dart: 43 pass | C#: builds clean (integration tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- antd-zig: remove parseGraphEntry, GraphDescendant from json_helpers
  and 3 graph-related tests from tests.zig
- antd-csharp: already fixed graph.proto in csproj (prior commit)
- antd-kotlin: proto files copied by gradle copyProtos task (no graph)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- lib/build.gradle.kts: add afterEvaluate block to ensure generateProto
  depends on copyProtos (was running before proto files were copied)
- lib/build.gradle.kts: add junit-platform-launcher to test runtime
  (was failing with "Failed to load JUnit Platform")
- examples/build.gradle.kts: add kotlinx-coroutines-core dependency
  (examples use runBlocking which requires coroutines on classpath)

Kotlin tests now pass: 7/7 (SmokeTests).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests run against a real antd daemon (default http://127.0.0.1:51105,
override via ANTD_TEST_URL env var). All gracefully skip when no
daemon is reachable, so CI still passes without infrastructure.

- antd-go: 8 integration tests (health, error mapping for no-wallet,
  invalid address, missing upload_id, no-peers cost)
- antd-py: 7 integration tests (health, BadRequestError for invalid
  hex, NotFoundError for valid-but-missing address, ServiceUnavailable
  for wallet ops, error for cost without peers)
- antd-js: 8 integration tests (health, ServiceUnavailableError,
  BadRequestError, AntdError, NetworkError on unreachable port)

Verified all 23 tests passing against antd in local mode (no wallet,
no peers).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 tests covering all REST client operations: health, data (public/
private), chunks, wallet, archives, files, external signer, and error
mapping for 6 HTTP status codes. Uses a lightweight HttpListener-based
mock server — no external mocking libraries required.

C# now has parity with the other SDK test suites.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Nic-dorman
Nic-dorman merged commit b72005c into main Apr 1, 2026
@Nic-dorman
Nic-dorman deleted the feat/sdk-test-coverage branch April 7, 2026 17:44
Nic-dorman added a commit that referenced this pull request May 14, 2026
… on stop (#81)

ant-devnet keeps anvil alive past Testnet::new scope via std::mem::forget
on the AnvilInstance, then relies on graceful Drop at process exit to
clean it up. SIGTERM/SIGKILL skip destructors, so every ant dev stop
leaks one anvil child and one ~/.local/share/ant/nodes/<peer_id>/ tree
for each of the spawned nodes. After a handful of start/stop or
killed-mid-startup cycles, the LXC accumulates orphan anvils plus 100+
stale node dirs, and subsequent ant dev start runs flake or hang.

This is a workaround at the ant-dev layer (Option B in #73). The proper
fix lives in ant-devnet itself (Option A: tempfile::TempDir + tokio
signal handler, mirroring how ant-clients MiniTestnet and ant-nodes
tests/e2e/testnet.rs already do it) and will be a separate PR against
WithAutonomi/ant-node.

In ant dev stop now:
- pkill anvil and antnode in addition to ant-devnet
- rm -rf ~/.local/share/ant/nodes and ~/.local/share/ant/spill so the
  next start begins from a clean state
- Centralise the pkill calls into a _pkill() helper

No behaviour change on Windows (the pkill / rm paths are POSIX-only).

Closes #16 (local task); helps mitigate #73 (upstream).
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