integration

package module
v0.0.0-...-9386a24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2023 License: MIT Imports: 16 Imported by: 0

README

Integration module

The integration module is meant as a helper to blackbox test a WASI module. It's a shortcut to instantiate and execute a module in the context of buildr.

The workflow basically looks like this:

  1. Compile module e.g. with tinygo to *.wasm file
  2. Create a integration.Host (with integration.NewHost(...) function)
  3. Specify the scenario (category, type, ...)
  4. Execute the module

A very basic example can be found in the hello_world_go example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StateKey

func StateKey(cat sdk.Category, modName, key string) string

Types

type Host

type Host struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewHost

func NewHost(logger *slog.Logger, opts ...HostOption) *Host

func (*Host) Run

func (h *Host) Run(ctx context.Context, wasiPayload []byte, spec TestSpec) (err error)

type HostOption

type HostOption func(h *Host)

func WithState

func WithState(key string, value []byte) HostOption

type Message

type Message interface {
	MarshalVT() (dAtA []byte, err error)
	UnmarshalVT(dAtA []byte) error
}

type TestSpec

type TestSpec struct {
	ModuleCategory sdk.Category
	ModuleType     string
	ModuleName     string
	RawTaskSpec    []byte
}

type TestWriter

type TestWriter struct {
	TB testing.TB
}

func NewTestWriter

func NewTestWriter(tb testing.TB) TestWriter

func (TestWriter) Write

func (t TestWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL