optimism

op-devstack

Devstack provides typed test presets and DSL helpers for integration and acceptance testing.

Overview

Packages

graph TD
  sysgo --builds runtimes--> presets
  presets --wraps runtimes--> dsl
  dsl --uses shared interfaces--> stack

  userMain --creates test setup--> presets
  userTest --uses test setup--> presets

Patterns

There are some common patterns in this package:

Components

Available components:

DSL-only components

Some components are DSL-only: these are ephemeral, live only for the duration of a test-case, and do not share state with other tests.

Available components:

presets, Option, TestSetup

The presets package provides options, generally named With....

Each Option may apply changes to one or more of the setup stages. E.g. some options may customize contract deployments, others may customize nodes, and others may do post-validation of test setups.

A TestSetup is a function that prepares the frontend specific to a test, and returns a typed output that the test then may use.

Design choices

Environment Variables

The following environment variables can be used to configure devstack:

Rust stack env vars:

Go stack env vars:

Metrics env vars:

Other useful env vars:

Metrics

If metrics are enabled and any component is configured to expose metrics, prometheus and grafana instances will be created via docker to serve them to the user.

If metrics are enabled, the grafana instance will be served at http://localhost:3000. If that port is in use, the dev stack may fail to deploy.

Requirements

The Docker binary must be installed and either be available in your PATH as docker or configured via SYSGO_DOCKER_EXEC_PATH See Environment Variables.

Configuring dashboards

When configuring dashboards, note that there is a single prometheus datasource available at http://host.docker.internal:9999.

[!TIP] It is recommended to set a SYSGO_GRAFANA_PROVISIONING_DIR and SYSGO_GRAFANA_DATA_DIR. This allows any configured datasources, dashboards, and visualizations to persist across restarts. If these variables are not set, temporary directories will be used and any configuration will be lost on restart.