Files
connector-macos/smoketest/README.md
T
davidandClaude Opus 5.5 5fd4fa5a98 smoketest: Tart now installs from openai/tools
brew install cirruslabs/cli/tart no longer works; Tart's README now
says brew install openai/tools/tart. Its images are still published
under ghcr.io/cirruslabs, so the default image stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:07:02 -07:00

86 lines
6.7 KiB
Markdown

# Smoketest
These tests run `configure`'s pieces on real macOS, in throwaway virtual machines made with [Tart](https://tart.run) on an Apple silicon Mac. They check what can't be checked on Linux:
- macOS' bash 3.2
- JavaScript for Automation, the keychain and `profiles`
- `dns-sd`
- Seatbelt, which srt's sandbox uses
- launchd
- Gatekeeper and code signatures
- real downloads
## Running it
On an Apple silicon Mac:
```
brew install openai/tools/tart
smoketest/run --list # scenarios and their tier
smoketest/run # the quick scenarios
smoketest/run --tier all # everything, including the big downloads
smoketest/run 60-backup # one scenario (or: smoketest/run 60)
smoketest/run --keep 50 # leave the VM running afterwards, to look around
smoketest/run --image ghcr.io/cirruslabs/macos-sequoia-vanilla:latest # another macOS
```
It tests the working copy as it is, including uncommitted changes. The first run downloads the image, about 25 GB. After that, each scenario takes a minute or two plus its own work. The backup scenario takes a few minutes, and `70-apps` downloads about 400 MB.
Each run writes its logs to `smoketest/results/<time>/`, one per scenario, and prints which scenarios passed.
## How it works
Each scenario runs on a fresh clone of Cirrus Labs' **vanilla** macOS image (default: Tahoe):
- **What's in it:** macOS as it comes, with auto-login and a user `admin` (password `admin`) who has passwordless sudo.
- **Why vanilla:** the "base" images come with Homebrew, Node.js and jq. Those would hide the paths a new Mac takes, where `configure` has to download its tools.
- **Gatekeeper:** the vanilla image switches Gatekeeper off, so `70-apps` switches it back on before testing downloads.
`run` drives each scenario from your Mac:
1. Clones the image with `tart clone` and starts it with `tart run --no-graphics`.
2. Puts a throwaway SSH key in the VM. The password `admin` is entered once, through `SSH_ASKPASS`.
3. Copies the working copy to `~/connector` in the VM.
4. Runs `lib/runner.sh` with the scenario in the VM's desktop session, through `launchctl asuser`. That is where `configure`'s GUI pieces run on a real Mac: `open`, launchd's gui domain, the unlocked login keychain. An SSH session isn't.
5. Stops and deletes the VM, unless `--keep` is given.
## Scenarios
| Scenario | Checks |
|----------|--------|
| `00-environment` | Every script parses with `/bin/bash` 3.2. None uses a tool macOS lacks: no python3, which would start installing the Command Line Tools, and no jq, timeout or mapfile. The macOS tools used are all there. |
| `05-install` | `install.sh` piped into bash, as `curl \| bash` runs it, with the working copy. The commands are in `~/.local/bin` and a login zsh finds them, and `update` swaps in a fresh copy without leaving staging folders behind. Then the published version installs from Gitea, records its commit, and `update` says it is up to date. |
| `10-configure` | `configure --help`, `--list` (nothing on stderr; agent sign-ins hidden until installed), the menu, and an item's questions |
| `20-json-keychain` | `json_get` and `json_edit` through real `osascript`; saving, replacing and deleting keychain secrets |
| `30-core-local` | The profile: valid, passwords and names survive escaping, stable payload UUIDs, and the format of `profiles show -output stdout-xml`. Superpanel's app: built, re-signed after the icon changes, and it opens. Element's config, and `nextcloud.cfg` matching |
| `40-mdns` | `dns-sd` output comes through a pipe and is stopped on time; the VM finds its own `_ssh._tcp` and resolves its `.local` name |
| `50-sandbox` | Node.js and srt download and install. A stand-in agent in the sandbox can't read `~/.ssh` or the keychains, and can't write outside its project. It can use /tmp, mktemp and a pty. It reaches allowed sites only. It reaches a local LLM server only once `ai-servers` allows it. A new zsh finds the sandboxed command first. |
| `60-backup` | restic and rclone download. A local WebDAV server stands in for Nextcloud. The Federated Backup app is built and answers whether it has Full Disk Access. launchd runs a backup, a snapshot appears, a file restores from it, and a second run the same day does nothing. Turning backups off removes the app and the job. |
| `70-apps` *(all)* | With Gatekeeper on: an un-notarized app is turned down, and a package signed by the wrong Team ID is refused. Element, Nextcloud and Tailscale download and install, and their Team IDs match `apps.sh`. Nextcloud opens with the Core's address. |
| `80-storage` | The launchd job is added with the first share and removed with the last; a share whose server can't be reached is skipped quickly without asking |
| `85-sftp` | macFUSE and SSHFS install, with their Team IDs checked; FSKit is chosen on macOS 26. Then it tries to turn on macFUSE's extension with `pluginkit`. If that works, the VM mounts a folder from itself over SSH, a file reads and writes through the mount, and storage-mount mounts it again after it's unmounted. |
## What still needs a person
macOS deliberately allows these only with a click, so test them by hand on a VM (`--keep`) or a Mac. Each scenario notes which apply to it as a `skip` line.
- **Installing the profile:** in System Settings > Profiles, choose "Federated Core (...)", then Install. Then check Mail, Calendar and Contacts against a real Core. `configure core` notices the profile was installed.
- **Full Disk Access for Federated Backup:** after granting it, `configure backup` says it can read all your files, and the backup log no longer has permission errors for Documents and Desktop.
- **Turning on macFUSE's file system extension**, if `85-sftp` couldn't do it with `pluginkit`: then mount an SFTP folder with `configure storage`.
- **Mounting a real SMB share:** the sign-in window, "Remember this password in my keychain", and whether `mount volume "smb://host"` without a share offers a list of shares.
- **Tailscale's VPN approval**, and **Nextcloud's sign-in** in the browser.
## Writing a scenario
A scenario is a bash file in `scenarios/` that sets `DESCRIPTION` and `TIER`, either `quick` or `all`, and defines `scenario`. It runs in the VM with what `configure` gives items: `CONNECTOR`, `CONF_DIR`, and `confirm` and `confirm_yes`, which always answer yes. So it can source an item and call its functions. Checks, from `lib/runner.sh`:
| Check | |
|-------|---|
| `check "what" cmd...` | ok if the command succeeds; otherwise FAIL, with its output |
| `check_not "what" cmd...` | ok if the command fails |
| `check_eq "what" expected actual` | ok if they're the same |
| `skip "why"` | Note something not checked |
| `step "what"` | A heading |
`check` runs its command in a subshell, so variables it sets don't last. Set those before the check.