Skip to content

Suites

A suite groups tests sharing a YAML configuration and environment facts. Register it with suite(definition) in a file named *_bftest.lua. Each entry in tests is a Test; the suite's Platform object is documented on this page.

Properties

name

The suite's name in reports and filters.

configuration

string

Optional YAML content, not a filename. Omit it to test the file selected by bifroest test --configuration PATH or the normal configuration fallback. Use this property for a suite that deliberately has its own fixture, for example file_content("configuration.yaml") reading beside the suite. Explicit content takes precedence over the CLI fallback. Empty or invalid content is an error, not a request to try a different source; see configuration selection.

environment

An object describing known users, groups and absences. These are test facts, not an environment backend to start. Use object {} if no facts are needed.

tests

[]Test

An ordinary Lua array of 1–64 test tables with consecutive keys starting at 1. Each entry supplies an input and a function that checks the calculated result. Use { ... }, not the read-only list helper, for this declaration array.

platform

A table restricting this suite to particular Bifröst binaries. Omission imposes no restriction; see the Platform properties.

Platform

A plain Lua table selecting Bifröst binaries, not targets or SSH clients. The CLI uses its own build metadata and has no platform override flags.

Alternatives within one property are OR-combined; supplied properties are AND-combined. Omitted properties match everything; an explicit empty array matches nothing. Each array accepts at most 64 selectors.

os

Binary operating systems to match, for example linux, darwin or the group unix.

arch

Binary architectures to match, for example amd64 or arm64.

version

Binary versions to match, for example 1.2, [1.3.5,1.4.0) or development.

Examples

This is a complete suite for the configuration in the first-test guide. Save it under tests, then run bifroest test tests --configuration configuration.yaml from the directory containing that configuration file:

tests/reference_bftest.lua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
suite {
  name = "ssh-target",
  platform = { os = { "unix" } },
  environment = object {
    accounts = list { object { name = "alice", uid = 1001 } },
  },
  tests = {
    {
      name = "selected-user",
      input = object {
        request = object { requestingName = "ops" },
        authentication = object {
          primary = object { outcome = "allow", account = "alice" },
        },
      },
      verify = function(t, actual)
        t:IsEqual("selected", actual.decision)
        t:IsEqual("primary", actual.flow)
      end,
    },
  },
}

To restrict platform further, use a table such as:

1
2
3
4
5
local supportedBinaries = {
  os = { "unix" },
  arch = { "amd64", "arm64" },
  version = { "1.2", "development" },
}

Use supportedBinaries as the value of suite.platform.

Configuration fallback

For each suite, use the first applicable source:

  1. Its configuration content, when supplied.
  2. --configuration PATH, relative to the invocation directory.
  3. The normal platform configuration file.

The flag is a fallback, not an override. An unreadable/invalid chosen source fails instead of trying the next one. The shared fallback is read at most once, only when a selected test needs it. Loading starts no service or provider.

For the separate rules governing file_content, see the function reference.

Platform skips and declaration errors

A mismatch skips all declared tests in the suite before name filtering. It is not a pass; an entirely empty/excluded run still returns 2. Lua declarations must compile and register valid suites on every platform. In particular, file_content(...) in a declaration still reads its file. Selectors do not hide syntax, helper, schema or quota errors.

Unknown suite/test properties are errors. Lua helpers and generated arrays are supported, but test groups and executable module/file includes are not. Excluded suites do not load/validate YAML, read a configuration fallback, evaluate rules or call verify. Limits are listed separately.