Component test reference

verifier init

The init subcommand: an interactive walk-through that sets Verifier up

Walk through setting Verifier up for your project, write the configuration, and check the result.

Synopsis

verifier [-c FILE] init [-f] [--fresh]

Description

verifier init is an interactive walk-through for getting a component under test. It looks at the working directory, reports what it found, asks about your component and how it communicates, writes the configuration file, optionally generates the files you need to run Verifier locally and in a pipeline, then runs the same checks as verifier doctor and prints what is left to do.

The first screen asks whether this is your first time using Verifier. Press y to read a short walkthrough first, or n to go straight to the setup. Your answer is not written anywhere and adds no configuration key. The question is skipped when init read an existing configuration, since you have evidently been here before. --fresh asks it even with a configuration in the directory, because --fresh ignores every file already there.

Answering y opens a walkthrough covering what Verifier does, what you supply – a runnable component, a compiled interface model, a license file, and a transport your component already speaks – and what the setup writes. The arrow keys, j and k, page up and page down, and the mouse wheel scroll it; space or enter starts the setup. The line you scroll to is the top line on screen. It closes by naming verifier docs open usage for the full read. Quitting from either screen exits straight away and writes nothing.

Every field carries a short note saying what it is and where its value comes from. ? hides and shows those notes, from any section and from a transport’s own settings, and the key bar names which of the two it will do. Answering y to the first-time question starts with them showing; answering n, or skipping the question, starts with them hidden.

The walk-through is a menu of sections. Move through the list with the arrow keys, press enter or space to open a section, and move back to the section list from a section’s fields with the left arrow. Enter or space on a field acts on it: a yes/no field flips, a field with a fixed set of values opens a list to pick from, and anything else opens for typing. Some lists are read from your model rather than fixed: changing the compiled model path refreshes the components it offers, without leaving the section. The key bar at the bottom names what enter and space will do to the field you are on. Press w to finish and write, or q to quit without writing anything.

Quitting once you have opened a section or changed an answer asks first, so a stray key does not throw the walk-through away. The warning names its two choices: q or esc quits and discards everything, space cancels and returns you to where you were. With nothing yet opened or changed, q quits straight away.

Only the sections you open are applied. Running init again over an existing configuration leaves every setting in a section you did not open exactly as it was, so it is safe to use for changing one part of a working setup. Comments and any key Verifier does not recognise are not preserved.

Fields only you can answer start empty rather than holding a guess: how the component starts, the compiled model, and the license file. A warning strip above the key bar names what is still missing and updates as you answer, so an empty start command, an unset container image, an unset pod namespace or name, a missing start, stop, or watch command, a missing compiled model, an unnamed component under test, and a missing license file are all visible while you work. The strip also names a path with no file behind it, so a compiled model or a license file you point at that is not there reads as plainly as one you never set. Turning on a generated file adds that file’s own settings to the strip, so a compose file with no container image for the component, and a pipeline file with no runner image or no build command, are named the same way. A yellow ! marks every section in the menu that still holds one of those settings, so the strip’s text has somewhere to point. Writing with a warning still showing is allowed: the strip says what to come back to, it does not block you. A path you type is kept either way – a license file mounted only at run time is warned about, not rejected.

You do not type the component under test. init reads the compiled model you point it at and offers the components it declares as a list to pick from, so you never have to remember a fully-qualified name. A model declaring exactly one component has it selected for you and written to the configuration. A name from an existing configuration that this model does not declare is kept rather than dropped, and init says which components the model does declare. When the model cannot be read – the path is wrong, or the file is not compiled Flex JSON – the field asks for the name instead and says why it had nothing to offer.

init needs a terminal. When output is redirected it exits with an error rather than guessing, because there is no way to ask you anything. Set individual keys with verifier config <field> <value> instead.

Before prompting, init reports the configuration file, compiled model, model sources, pipeline files, compose files, local run script, and license file it found. When exactly one license file is present it offers to use it. When only model sources are present and no compiled model, it says so: Verifier reads the compiled model, not the sources, and the gap is recorded in the checklist.

Nothing is written without asking. Each file is confirmed on its own, and declining offers a different path to write to instead. Overwriting the configuration file init read is the default answer, so pressing enter keeps the answers you just gave. Declining it, and then declining to name another path, cancels the run: nothing is written and no error is reported. -f skips those questions.

The Communication section holds a list of transports rather than a single one. Opening it shows every transport already configured, with + Add Transport underneath them, or on its own when there are none. Enter or space on a transport opens its settings; enter or space on the add row starts a new one. With no configuration to read, the list starts empty. A new transport is named after its type, and that name keeps following the type until you type a name yourself. Inside a transport, y keeps your changes and n goes back to the list. y appears only once you have changed something, and n says so when leaving would discard changes. The last row of a transport’s settings deletes that transport and returns to the list.

Opening the Component section replaces the whole component command list with the one command you describe, because Verifier tests one component at a time. Opening the Communication section replaces the whole transport list with the transports it holds when you finish, so deleting every one of them writes a configuration with no transports. A section you never open is left as it was.

Within a section you do open, a setting the walk-through never asks about keeps the value your configuration already gave it. A transport is matched to the one it was read from by name, so renaming a transport starts it from the defaults instead. A transport type the walk-through does not offer is left exactly as it was, and says so.

Options

  • -c/--config FILE: Optional (Defaults to verifier.yaml) The configuration file to read and to write. An existing file at this path is read first, so the walk-through opens on its current values. When nothing is at that path the walk-through starts from defaults and the file is created. A file that is there but cannot be read stops init with the error instead, so a configuration is never replaced by defaults you did not choose. When you leave this option out and the directory holds a verifier.yml, that file is read and the answers are written to verifier.yaml.
  • -f/--force: Optional Overwrite existing files without asking about each one.
  • --fresh: Optional Ignore every file already in the directory and start from defaults, as though the directory were empty.

Sections

  • Component: how the component starts – a process, a container, a Kubernetes pod, or a command handled outside Verifier – and how long to wait after starting it, after stopping it, and between messages.
  • Communication: the transports that connect Verifier to the component. Each one carries its own type, its commonly-required settings, and which model connections to pin to it – picked from the connections the model gives the component under test, and typed in when the model cannot be read. Everything else keeps the value your configuration already had, or the transport’s default when there was none.
  • Serialization: the format messages are encoded in, and any per-package override.
  • Message model: the compiled model, which of its components is under test – picked from the model itself – and the license file.
  • Runtime Environment: which of the pipeline job, workflow, compose file, and local run script to generate. Turning one on adds the settings it needs, indented under it.
  • Test coverage: how many iterations to run, and how many attempts each protocol gets. Only valid messages are generated, so the test type is not asked about; set test_type yourself to send invalid or random messages.
  • Known limitations: things Verifier cannot check. Answering yes changes nothing about the run; it records the limitation in the checklist so it is not a surprise later.

Generated Files

Each of these is optional and selected in the walk-through. Every one wires in the broker or proxy each configured transport needs, once per broker however many transports use it.

Verifier does not ship transport proxy images. When your transport goes through a proxy, the generated files name a placeholder instead of an image, and the checklist tells you to replace it with the proxy your deployment runs. Broker images for the message brokers are named directly, and you can change any of them before use.

A file you turn on is written whether or not you answered its settings. A compose file with no container image for the component names a placeholder image, and a pipeline file with no build command carries a build step that does nothing, so the checklist names each one for you to fix.

  • A pipeline job for GitLab, written beside your pipeline file so it can be included rather than overwriting it.
  • A GitHub Actions workflow.
  • A compose file that brings up the component, the transports’ brokers, and Verifier together.
  • A local run script that starts the brokers and runs the test. It stops whatever it started on the way out, however the test ends, so a failed run leaves nothing holding a port.

init also writes the next-steps checklist as a markdown file beside the configuration, and prints it. The checklist names every file init wrote, every gap it could not close, and every limitation your answers revealed.

Examples

Set up a new project from an empty directory:

verifier init

Write the configuration somewhere else:

verifier -c staging.yaml init

Start over, ignoring everything already in the directory:

verifier init --fresh

Re-run without being asked about each existing file:

verifier init --force

See Also

verifier docs open commands/doctor, verifier docs open commands/config, verifier docs open commands/run, verifier docs open configuration, verifier docs open transports, verifier docs open component, verifier docs open usage