Skip to content

integration: add tailscale-rs client test harness#3196

Merged
kradalby merged 3 commits intojuanfont:mainfrom
kradalby:kradalby/tailscale-rs
Apr 29, 2026
Merged

integration: add tailscale-rs client test harness#3196
kradalby merged 3 commits intojuanfont:mainfrom
kradalby:kradalby/tailscale-rs

Conversation

@kradalby
Copy link
Copy Markdown
Collaborator

@kradalby kradalby commented Apr 16, 2026

This PR adds integration tests for the new tailscale-rs library with Headscale to make sure it works from the beginning.

  • Add integration/tsricTailscaleRustInContainer, Rust counterpart
    to tsic.
  • Add Dockerfile.tailscale-rs — clones tailscale-rs at build time and
    compiles the axum example. Repo/ref are build-args; default is
    upstream main.
  • Add TestTailscaleRustAxum — registration, peer visibility, HTTP
    (GET /index.html, GET /assets/index.css, POST /count).

Headscale's integration harness runs the control plane over plain
HTTP, so the Dockerfile patches the cloned root Cargo.toml to
re-expose ts_control/insecure-keyfetch through the tailscale crate
and builds the axum example with that feature enabled.

@kradalby kradalby marked this pull request as ready for review April 16, 2026 13:49
@kradalby kradalby force-pushed the kradalby/tailscale-rs branch 2 times, most recently from 1ce3e83 to f6e44a3 Compare April 28, 2026 09:24
Add TailscaleRustInContainer (tsric), a Rust-client counterpart to
integration/tsic. It runs the axum example from tailscale-rs in a
Docker container and exposes the same lifecycle hooks as tsic
(Shutdown, SaveLog, Execute, WriteFile) so integration tests can
treat it as any other Tailscale node.

Dockerfile.tailscale-rs clones tailscale-rs at build time, so no
local source checkout is required. The repo URL and ref are Docker
build arguments (TAILSCALE_RS_REPO, TAILSCALE_RS_REF) exposed as
tsric.WithRepo / tsric.WithRef options. The HEADSCALE_INTEGRATION_
TAILSCALE_RS_IMAGE environment variable provides an escape hatch
for using a pre-built image instead of building from source.

The Dockerfile patches the cloned root Cargo.toml to expose
ts_control's insecure-keyfetch feature through the tailscale crate
so the axum example can fetch the control key over plain HTTP.
The integration harness serves the control plane without TLS,
which is the only mode tailscale-rs can register against until it
grows a way to inject a custom CA bundle.
Add an integration test that runs the tailscale-rs axum example
against headscale end-to-end. The test provisions one headscale
instance, one Go tailscale probe client (tsic), and one
tailscale-rs node (tsric) on the same tailnet, then verifies:

  - the tailscale-rs node registers and is assigned both an IPv4
    and an IPv6 address
  - the Go probe sees the tailscale-rs node as a peer in its status
  - GET /index.html and GET /assets/index.css from the axum server
    return the expected content over the tailnet
  - three sequential POST /count calls return distinct, incrementing
    counter values, proving netstack state is maintained across
    multiple TCP connections

This is the first integration test that exercises a non-Go
Tailscale client against headscale, giving end-to-end coverage of
the control protocol for alternate implementations.
Pick up the new tailscale-rs integration test in the CI job matrix.
@kradalby kradalby force-pushed the kradalby/tailscale-rs branch from f6e44a3 to 17661da Compare April 28, 2026 09:39
@kradalby kradalby merged commit a7d405a into juanfont:main Apr 29, 2026
303 of 305 checks passed
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.

2 participants