Live Tests

Run this checkout's lnk against your real AWS and Google Cloud accounts, which cargo test checks only against fakes. Each run says what it cost.

You need jq, a build, and aws or gcloud signed in to the account to test. On Google Cloud without a person at the keyboard, set LNK_LIVE_GCP_KEY_FILE to a service account's key and the run connects as it. The shares stage also needs link-relay built, which cargo build does. A run costs about $0.01 for buckets, shares and restores and a few cents for boxes, billed to those accounts.

cargo build
# every stage, asking first
src/tests/live/run.sh
# only some, without asking
src/tests/live/run.sh --yes buckets-aws boxes-aws
# boxes running this checkout's lnk, not the latest release's
src/tests/live/run.sh --checkout boxes-gcp agents-gcp

What each stage checks

Each stage sets up what it needs, checks one part against one cloud, and removes what it made.

  • buckets-aws and buckets-gcp run cloud connect, then bucket create, push, tree, clean, pull (the files come back unchanged), remove and delete. They check the buckets are gone from the cloud.
  • shares-aws runs bucket share through a relay of the run's own on this computer. Its page links each file, which downloads unchanged from the cloud. The stage also covers --auth, shares, unshare, and bucket pull <link> where <user>.localhost resolves.
  • restore-aws and restore-gcp use a Link Harness agent. They run agent backup and agent restore from the cloud, then a second backup after a conversation grew and a note changed at the same size, and check that a restore with no backup is refused.
  • boxes-aws and boxes-gcp run box start, list, ssh and run, and vpn exit home, where the box leaves from this computer's address and stops when it's off. They run box stop, start again and remove. Nothing of the run is left in the account, and what Link shares between boxes (a key pair, a security group, a firewall rule) is as it was.
  • agents-aws and agents-gcp start a box, then agent new with Link Harness here. agent move takes it to the box, where it runs with its ID and files and is gone from here. agent move ... here brings it back, running here with its files and gone from the box. The box's checks look for what's left.

The agents stages give Link Harness a made-up key for a hosted model. Nothing sends the agent a message, so the key is never used and no model is billed. The agent's name is the run's own, live-<time>, so its background service is never one of yours.

This checkout's lnk on the box

A box installs lnk from the latest release. With --checkout, the run builds this checkout for Linux, static and for the boxes' x86_64 Ubuntu, and copies lnk and every plugin onto each box after it starts. The stage then checks that the box's programs match the build.

  • On Linux (x86_64), run rustup target add x86_64-unknown-linux-musl and sudo apt-get install musl-tools.
  • On a Mac, add the same target and run brew install zig && cargo install cargo-zigbuild.
  • Or set LNK_LIVE_BOX_BIN=<dir> to a folder with a Linux build already made, and the run uses it instead of building.

Without --checkout, the stages test this checkout's box, cloud, vpn, harness and adapter plugins driving a released lnk on the box. Each box's first line says which version it got.

On Linux

The stages that run a background service on this computer need a Mac. The run keeps its services in its own home, and systemd reads a person's services only from their real one. On Linux, the boxes stages skip the home exit and say so, and the agents stages don't run.

Where the results go

Each run is a folder in target/live/<run>/:

  • results.tsv has each stage, pass or fail, how long it took and its estimated cost.
  • <stage>.log has every command and its output.
  • home/ is the run's own home.

Every run also adds its rows to target/live/costs.tsv, one file across runs. The estimate uses the list prices in US regions that are at the top of run.sh, for a box's machine, public address and disk as long as it exists, and for a bucket's requests and storage.

A run's real bill

A run's boxes are tagged lnk-owner=github-<id>, with an id made up for that run and saved in target/live/<run>/owner. On AWS the instances and their disks carry the tag, and on Google Cloud the instances do.

On AWS, activate lnk-owner once as a cost allocation tag (Billing → Cost allocation tags), before the runs you want to see. A day or so after a run, src/tests/live/run.sh bill <run> prints what AWS billed it, by usage type, and each of those calls costs $0.01. On Google Cloud, open Billing → Reports and filter by the label lnk-owner.

Your settings are safe

A run never uses your lnk. It has its own home, with its own settings, SSH key and files, and a made-up login that isn't sent to any relay. Secrets stay in its files and never reach your Keychain (LNK_KEYCHAIN=off). It shares only your aws and gcloud logins.

Everything a stage makes, it removes, even when a check fails or you stop it with Ctrl-C. What it can't remove, it prints, with the command to remove it by hand.

Decisions says why the suite works this way.