Skip to content

Check the version before trusting a diagnosis

Print the version every other surface derives from, and see the argument it refuses.

guaranteed Getting started and adoptionbasicoperatorcontributorread-only

Situation

A diagnosis from one machine is compared with a repository on another, and nobody knows whether the two ran the same tool.

Scenario

setup: bare
given:
  - 'an empty repository; nothing installed'
steps:
  - id: print
    run: ['version']
    note: 'the one string the projections, the ledger and the site derive their version from'
    expect:
      exit: 0
      stdout_contains: ['^majordomus [0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)\.[0-9]+)?$']
  - id: refuse
    run: ['version', '--no-such-option']
    note: 'an argument the command does not know is a usage error, never ignored'
    expect:
      exit: 2
      stdout_contains: ['unknown option --no-such-option']
then:
  - 'the version needs no repository and no installation'
  - 'a usage error exits 2, as the exit-code contract says'

Outcome

version prints the version and nothing else, from anywhere, and refuses an argument it does not understand rather than pretending it did.

The scenario

Executed against the real tool, in a repository prepared by bare, every time this site is generated. What follows is not a description of what should happen; it is what happened.

given

  • an empty repository; nothing installed

when

  1. 1majordomus version
  2. 2majordomus version --no-such-option

then

  • the version needs no repository and no installation
  • a usage error exits 2, as the exit-code contract says

What the tool did

Evidence of the run this page was generated from: pass, 2 step(s). Output is normalised: the repository's path, timestamps, ids and durations are placeholders; nothing else is edited.

Tested by test/cases/94_use_cases.sh, which runs every scenario and refuses a step whose recorded output is not what it produced.

  1. the one string the projections, the ledger and the site derive their version from

    majordomus 1.0.0-alpha.8
    • exit 0
    • stdout_contains /^majordomus [0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)\.[0-9]+)?$/
  2. an argument the command does not know is a usage error, never ignored

    majordomus: version: unknown option --no-such-option
    • exit 2
    • stdout_contains /unknown option --no-such-option/

Why the tool knows this

The chain from this page to the code: the use case names commands, rules and claims; each rule is dispatched from the registry and each claim names the test that proves it; the scenario above executed the commands. Nothing in this chain is prose about intent.

Guarantees exercised

Related use cases

Computed from what they share: claims, rules, commands, category, applications. Nobody maintains this list.

The moments this answers

Searches the titles and descriptions of every page this site publishes.