Skip to main content
The Palyra CLI (palyra) is designed to operate consistently across Linux, macOS, and Windows. To ensure this consistency, the codebase employs a multi-layered testing strategy including platform-specific help snapshots, a parity matrix for command coverage, and automated “smoke” tests that validate installation and critical workflows (setup, backup, and update) on all supported operating systems.

CLI Parity Framework

The CliParityMatrix is the central definition of expected CLI behavior across platforms. It ensures that every command is accounted for, categorized, and has an associated help snapshot for regression testing.

CliParityMatrix Implementation

The framework is defined in palyra-cli/src/cli_parity.rs and utilizes a TOML-based matrix (tests/cli_parity_matrix.toml) to track the status of the CLI surface area crates/palyra-cli/tests/help_snapshots.rs#6-6.
  • CliParityMatrix: A collection of CliParityEntry items representing the entire command tree.
  • CliParityEntry: Contains the command path (e.g., palyra agents list), its category (e.g., management), and a CliParitySnapshotSpec.
  • CliParitySnapshotSpec: Defines which file contains the expected help output for a given platform. This handles differences in line endings and file extensions (e.g., palyra vs palyra.exe) crates/palyra-cli/tests/help_snapshots.rs#22-24.

Help Snapshot Testing

The help_snapshots_match_cli_parity_matrix test crates/palyra-cli/tests/help_snapshots.rs#75-126 iterates through the matrix and executes palyra <cmd> --help. It compares the actual output against stored text files in tests/help_snapshots/. Data Flow: Parity Verification The following diagram shows how the parity matrix drives the snapshot verification process. Title: CLI Parity Verification Flow Sources: crates/palyra-cli/src/cli_parity.rs, crates/palyra-cli/tests/help_snapshots.rs#75-126, crates/palyra-cli/tests/help_snapshots/root-help-unix.txt#1-5

Install Smoke Tests

Install smoke tests validate that the CLI functions correctly after being packaged and installed, rather than just running in a development environment. These tests are executed via scripts/test/run-cli-install-smoke.ps1 (PowerShell) and its shell script equivalent scripts/test/run-cli-install-smoke.ps1#1-46.

Smoke Test Lifecycle

  1. Context Creation: New-ScenarioContext generates a temporary filesystem layout including config/, state/, and vault/ directories to simulate a fresh installation scripts/test/run-cli-install-smoke.ps1#41-83.
  2. Environment Isolation: The script sets PALYRA_CONFIG, PALYRA_STATE_ROOT, and PALYRA_VAULT_DIR to point to these temporary locations, ensuring no interference with the host system scripts/test/run-cli-install-smoke.ps1#85-101.
  3. Command Execution: Invoke-TranscriptCommand runs the binary and captures stdout/stderr/exit codes into a transcript log for debugging scripts/test/run-cli-install-smoke.ps1#126-203.

Validated Commands

The installed_binary_runs_baseline_smoke_commands test crates/palyra-cli/tests/installed_smoke.rs#39-148 verifies: Sources: scripts/test/run-cli-install-smoke.ps1#41-203, crates/palyra-cli/tests/installed_smoke.rs#39-148

Workflow Regression Matrix

The workflow regression matrix validates complex, multi-step CLI operations like the setup wizard and configuration migration. This is implemented in crates/palyra-cli/tests/workflow_regression_matrix.rs.

Regression Scenarios

The test local_remote_and_lifecycle_workflows_are_regression_tested crates/palyra-cli/tests/workflow_regression_matrix.rs#29-188 covers the following critical paths:
WorkflowCommandKey Validations
Local Setuppalyra setup --mode localCreates palyra.toml, initializes local state crates/palyra-cli/tests/workflow_regression_matrix.rs#57-85.
Remote Onboardingpalyra onboarding wizard --flow remoteValidates server certificates and admin tokens crates/palyra-cli/tests/workflow_regression_matrix.rs#87-119.
Configurationpalyra configure --section gatewayModifies ports and TLS profiles in existing config crates/palyra-cli/tests/workflow_regression_matrix.rs#121-162.
Backuppalyra backup createArchives config and workspace into a ZIP crates/palyra-cli/tests/workflow_regression_matrix.rs#173-188.

Internal Architecture of Workflow Tests

The regression tests use a run_cli helper that wraps std::process::Command. It allows passing standard input (for interactive prompts) and environment variables crates/palyra-cli/tests/support/cli_harness.rs. Title: Workflow Regression Components Sources: crates/palyra-cli/tests/workflow_regression_matrix.rs#29-188, crates/palyra-cli/src/args/mod.rs#1-44, crates/palyra-cli/src/commands/mod.rs#1-48

CI Integration

The parity and smoke tests are integrated into the GitHub Actions pipeline to prevent platform-specific regressions. Sources: .github/workflows/cli-install-smoke.yml#1-63, crates/palyra-cli/tests/help_snapshots.rs#8-8