Test services reference

Look up the test-service schema, catalogue and limits, with the current availability restriction.

Availability

Declared test services are not yet offered to customer jobs. The current application source refuses any nonempty environment.service declaration with declared services are not offered yet, before creating a job. This was checked against the latest application main on 21 October 2026.

The declaration parser, service catalogue and guest runtime are implemented. Customer admission, service-aware automatic sizing and the complete job-status integration remain incomplete. Use this page to look up the implemented schema and runtime behavior; the examples cannot yet run through the customer execution path. See Versions & compatibility.

Service catalogue

Service name Exact version Default port Default memory Memory range
PostgreSQL "postgres" "18.6" 5432 1,024 MiB 256–16,384 MiB
Redis "redis" "7.0.15" 6379 256 MiB 32–16,384 MiB

These are the complete entries in the implemented catalogue, subject to the availability restriction above. The resolver rejects version ranges, channels, latest, other versions and custom container images. Each service name may appear once per job, so the current schema permits one PostgreSQL instance and one Redis instance. The declaration format has an overall limit of eight entries.

The guest runtime runs services inside the job’s guest, listening on loopback, with temporary test data. This does not provide a connection to an external database. See Declare test services for configuration examples.

Configuration schema

Declare each service with [[environment.service]] in the repository-root sorus.toml. See configuration-file compatibility for older checkouts; keep only one root configuration file. Field names are case-sensitive. Unknown fields, wrong types and options unsupported by the selected service are refused.

Fields shared by both services

Field TOML type Required or default Accepted values
name String Required "postgres" or "redis". This selects the service; it is not a custom instance name.
version String Required The exact version paired with name in the catalogue above. Quote the version.
port Integer Catalogue default 1024–65535, excluding guest-reserved ports 7401 and 7402. Effective ports, including defaults, must be unique across services.
memory_mib Integer Catalogue default Within the service’s memory range above, subject to the combined job limit below. This is a memory limit in MiB, not a PostgreSQL buffer size or Redis maxmemory setting.

PostgreSQL fields

Field TOML type Default Accepted values and behavior
user String "postgres" Initial PostgreSQL role. 1–128 ASCII bytes: lowercase letters, digits and _; the first character must be a lowercase letter or _.
password String "postgres" 1–128 ASCII bytes, using letters, digits and the punctuation listed below. Used for PostgreSQL TCP authentication and included in the connection URL.
database String "postgres" Database used by the connection URL and SQL initialisation. Uses the same character and length rules as user. Sorus creates it when it differs from postgres.
settings Table of string values {} Only the 18 settings listed below. Values must be quoted strings, including numbers and booleans.
initialize Array of strings [] Repository-relative SQL file paths or filename patterns. At most 64 distinct entries, matching at most 512 distinct captured files. See SQL initialisation.

The permitted password punctuation is - . _ ~ ! $ & ( ) * + , ; =. Spaces, quotes, @, /, : and non-ASCII characters are refused. These are credentials for the temporary test database; use values intended for tests, not production credentials.

Each identity field defaults independently: changing user does not change password or database. The length limits above are Sorus’s declaration checks; PostgreSQL still applies its own identifier and startup rules.

Redis has no service-specific options. It does not accept user, password, database, nonempty settings or nonempty initialize. Empty settings = {} and initialize = [] are treated as absent; omit them from a Redis entry.

Examples

Choose a service to see its configuration. Both entries can coexist in the same file. The PostgreSQL example requires matching SQL files to exist in the captured source.

PostgreSQL

[[environment.service]]
name = "postgres"
version = "18.6"
port = 5432
memory_mib = 1024
user = "app_test"
password = "test_password"
database = "app_test"
initialize = ["tests/sql/*.sql"]

[environment.service.settings]
max_connections = "100"
shared_buffers = "128MB"
statement_timeout = "30s"
timezone = "UTC"

Redis

[[environment.service]]
name = "redis"
version = "7.0.15"
port = 6379
memory_mib = 256

PostgreSQL settings

The service resolver accepts the following settings in the settings table. Unspecified settings receive no Sorus override and retain the value selected by PostgreSQL’s initialisation or server defaults. The fixed configuration in the next section applies separately.

Setting Accepted string value
default_transaction_isolation "read uncommitted", "read committed", "repeatable read" or "serializable"
idle_in_transaction_session_timeout Duration
jit "on" or "off"
lock_timeout Duration
maintenance_work_mem Memory size
max_connections Whole number from "1" to "10000"
max_locks_per_transaction Whole number from "10" to "1000000"
max_prepared_transactions Whole number from "0" to "10000"
max_replication_slots Whole number from "0" to "1000"
max_wal_senders Whole number from "0" to "1000"
shared_buffers Memory size
standard_conforming_strings "on" or "off"
statement_timeout Duration
temp_buffers Memory size
timezone Time-zone name, such as "UTC" or "America/New_York"
track_commit_timestamp "on" or "off"
wal_level "replica" or "logical"
work_mem Memory size

Value formats are case-sensitive:

  • Whole numbers: at most 10 decimal digits, within the listed inclusive range. Signs, decimal points and exponents are refused.
  • Memory sizes: 1–10 decimal digits, optionally followed immediately by kB, MB or GB, such as "128MB". A value without a unit uses PostgreSQL’s unit for that setting.
  • Durations: 1–10 decimal digits, optionally followed immediately by us, ms, s, min, h or d, such as "30s". A value without a unit uses PostgreSQL’s unit for that setting.
  • Time zones: 1–64 ASCII characters, starting with a letter, then letters, digits, _, +, - or /. PostgreSQL must also recognise the name.

The general schema permits at most 32 settings, each with a nonempty printable-ASCII value of at most 128 bytes; the current allow-list contains only the 18 names above. Settings such as shared_preload_libraries, archive_command, listen_addresses and fsync cannot be supplied in this table.

These checks validate declaration syntax. PostgreSQL can still refuse a value outside its own limits, a conflicting combination or a configuration that cannot fit in the service’s memory. Such a failure prevents the test command from starting.

Fixed service configuration

PostgreSQL

Every PostgreSQL instance starts with UTF-8 encoding, locale C.UTF-8, trust authentication for local Unix-socket connections and scram-sha-256 authentication for TCP connections. Unix sockets are available in /run/postgresql and /tmp. The port field controls the listening port.

The following settings are fixed and cannot be overridden through settings:

Setting Value
listen_addresses 127.0.0.1,::1
fsync off
synchronous_commit off
full_page_writes off
logging_collector off
log_destination stderr

These durability settings suit a database discarded with the attempt. They do not provide production crash-durability behavior.

Redis

Redis binds to the loopback addresses, with protected mode disabled and no configured password. Snapshot persistence and append-only persistence are disabled. It runs in the foreground and writes logs to standard output. These options are fixed; the declaration only exposes name, version, port and memory_mib.

SQL initialisation

PostgreSQL applies initialize files to the configured database as the configured user, before the workload command starts.

Rule Behavior
Path base Repository root, regardless of the workload’s invocation subdirectory.
Path syntax 1–1024 printable ASCII bytes, without spaces, a leading /, empty components, . or .. components, or backslashes.
Wildcards * is supported only in the last path component and matches within that directory. Recursive directory globs, ?, [] and {} are unsupported.
Pattern count At most 64. Repeating an identical pattern is refused.
Matching Every pattern must match at least one captured source file. A file absent from the capture cannot be initialised.
File count At most 512 distinct matched files. Overlapping patterns apply the same file only once.
Execution order Byte order of the complete repository-relative path, regardless of pattern order. Numeric filename prefixes can make the intended order explicit.
Transactions One transaction per file, with psql stopping on the first error. The set of files is not one shared transaction.
Deadline Startup, readiness, database creation and SQL initialisation share a 60-second bound, measured from the first service start.

The files are tied to the captured content by digest. A failed SQL file or failed database-creation step is reported as a service-initialisation input problem; the workload command does not start. Retries start with fresh service data and run initialisation again.

Connection variables

After services are ready and initialisation succeeds, Sorus adds these variables to the workload command. Variables are present only for declared services, and custom fields change the corresponding values.

Variable Value with defaults
SORUS_SERVICE_POSTGRES_HOST 127.0.0.1
SORUS_SERVICE_POSTGRES_PORT 5432
SORUS_SERVICE_POSTGRES_URL postgresql://postgres:postgres@127.0.0.1:5432/postgres
SORUS_SERVICE_REDIS_HOST 127.0.0.1
SORUS_SERVICE_REDIS_PORT 6379
SORUS_SERVICE_REDIS_URL redis://127.0.0.1:6379

The PostgreSQL URL is postgresql://<user>:<password>@127.0.0.1:<port>/<database>. The Redis URL is redis://127.0.0.1:<port>. These URLs are for clients inside the same job. Sorus does not automatically set DATABASE_URL; map the service URL in your test setup when your application expects it.

Resources and lifetime

The implemented resource model gives each service its own memory limit. Combined service memory may be at most half the selected machine class’s job-memory ceiling. The workload’s remaining memory is that ceiling minus the combined service limits. Service-aware automatic sizing is not yet integrated into customer admission.

In the guest runtime, services start before the workload and run as the job’s unprivileged user under its confinement. Services stop before build-state preservation; their data stays on the attempt’s scratch drive and is discarded with the attempt. Build-state reuse does not restore service data. The implemented build-state key can include service versions, options and initialisation-file digests; admission does not yet connect this to customer jobs.

Runtime failures

These are the guest-runtime outcomes behind the current admission restriction. Full service reporting in customer job status is not yet available.

Stage Runtime behavior
Startup or readiness fails The workload does not start. The attempt reports the platform failure service_not_ready, with up to 4 KiB of service output in the failure detail.
Database creation or SQL initialisation fails or times out The workload does not start. The guest returns an input-failure result with exit 78 and a service-initialisation diagnostic. This is a guest result, not the Sorus CLI’s own exit-code contract.
Service exits or exceeds its memory limit during the workload Service diagnostics are appended, including an output tail of at most 16 KiB. The workload’s own exit code still controls its outcome; a service failure alone does not replace it.

See Inspect a job and the CLI exit codes for the existing customer-facing result interfaces.