Skip to content

Add migrations and test a plugin

A plugin change should pass both the shared Plugin API checks and the tests beside its implementation.

Tilecast has one Goose migration sequence across core and every plugin.

Create the next migration from the repository root:

Terminal window
npm run plugins:migration -- transit_alerts create_feeds

Keep both Goose sections:

-- +goose Up
-- schema change
-- +goose Down
-- reverse the schema change

Do not edit a migration that has shipped. Add another migration.

Plugin migrations run during the Tilecast release upgrade, not when an operator installs a plugin.

The scaffold creates:

func TestConformance(t *testing.T) {
plugintest.Conformance(t, New())
}

This checks the embedded manifest, contribution declarations, routes, migrations, and initialization contract.

Run the repository check too:

Terminal window
npm run plugins:check

It checks manifest and directory rules, import boundaries, route and docs ownership, OpenAPI fragments, CSS scoping, generated files, migration metadata, and nearby tests.

Use apps/server/pluginharness from plugin _test.go files when behavior depends on real database constraints, transactions, installation state, Host services, or migrations.

The harness is the one server package plugin tests are allowed to import.

Use PostgreSQL tests for locking, uniqueness, foreign keys, migration compatibility, and transaction ordering instead of replacing those checks with mocks.

Test Studio and Player code beside the plugin

Section titled “Test Studio and Player code beside the plugin”

Keep Studio tests under plugins/<name>/studio/. Shared plugin-host tests cover discovery, route collisions, and secondary-navigation rules.

Keep runtime tests under runtime/. Use @tilecast/plugin-sdk/runtime/testing for the manual clock and deterministic context.

Run:

Terminal window
npm run plugins:generate
npm run plugins:check

Then run the tests for the parts you changed. For docs changes, also run:

Terminal window
npm run docs:check
npm run docs:build

Generated files such as the Go registry, CODEOWNERS, migration lock, and composed OpenAPI document should not be edited by hand.