Skip to main content

Module lua_plugin

Module lua_plugin 

Source
Expand description

Support for Pact plugins written in Lua.

A Lua plugin is loaded as an embedded mlua interpreter running in the driver’s own process (executableType: "lua" in pact-plugin.json), instead of a separate child process speaking gRPC. The plugin script must define these global functions:

A Lua plugin that registers a TRANSPORT catalogue entry (instead of, or as well as, a CONTENT_MATCHER/CONTENT_GENERATOR one) must also define these functions. The plugin itself is responsible for whatever the transport actually requires (opening sockets, making outbound calls, etc.) - the driver only calls these functions at the right points in the test lifecycle, exactly as it would over gRPC for an exec plugin:

Each of these is called with either a V1-shaped or a V2-shaped request table, never both, depending on the plugin’s own pluginInterfaceVersion in its manifest - the same static, per-instance choice the driver makes for gRPC plugins (see plugin_manager.rs).

Structs§

LuaPactPlugin
A running Lua plugin instance. Each instance owns its own embedded Lua VM.