testmonkit

package
v1.104.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Overview

Package testmonkit allows attaching monkit monitoring for testing.

It allows to set an environment variable to get a trace per test.

STORJ_TEST_MONKIT=svg
STORJ_TEST_MONKIT=json

By default, it saves the output the same folder as the test. However, if you wish to specify a separate folder, you can specify an absolute directory:

STORJ_TEST_MONKIT=json,svg,dir=/home/user/debug/trace

Note, due to how go tests work, it's not possible to specify a relative directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, tb testing.TB, fn func(ctx context.Context))

Run attaches monkit tracing to the ctx where configuration is taken from STORJ_TEST_MONKIT.

func RunWith

func RunWith(parentCtx context.Context, tb testing.TB, cfg Config, fn func(ctx context.Context))

RunWith attaches monkit to the ctx with custom configuration.

Types

type Config

type Config struct {
	Disabled bool
	Dir      string
	Outputs  []string
}

Config defines configuration for monkit test output.

func EnvConfig

func EnvConfig(tb testing.TB) Config

EnvConfig loads test monkit configuration from STORJ_TEST_MONKIT environment variable.

Jump to

Keyboard shortcuts

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