mockruntime

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeHappy           = "happy"
	ModeHangBeforeFiles = "hang_before_files"
	ModeExitImmediately = "exit_immediately"
	ModeSlowStartup     = "slow_startup"
	ModeStartupFailure  = "startup_failure"

	EnvMockMATLABConfig = "MW_MCP_MOCK_MATLAB_CONFIG"
)

Variables

This section is empty.

Functions

func ShouldExitFromEvalCode

func ShouldExitFromEvalCode(code string) bool

Types

type Config

type Config struct {
	Mode     string `json:"mode"`
	ExitCode *int   `json:"exitCode,omitempty"`
	DelayMs  *int   `json:"delayMs,omitempty"`
}

func ExitImmediatelyConfig

func ExitImmediatelyConfig(exitCode int) Config

func HangBeforeFilesConfig

func HangBeforeFilesConfig() Config

func HappyConfig

func HappyConfig() Config

func SlowStartupConfig

func SlowStartupConfig(delayMs int) Config

func StartupFailureConfig

func StartupFailureConfig() Config

func (Config) ToEnvValue

func (c Config) ToEnvValue() (string, error)

type Environment

type Environment interface {
	Getenv(key string) string
}

type FileSystem

type FileSystem interface {
	WriteFile(name string, data []byte, perm os.FileMode) error
}

type Runtime

type Runtime struct {
	Env         Environment
	FS          FileSystem
	TLSProvider TLSMaterialProvider
}

func NewRuntime

func NewRuntime(env Environment, fileSystem FileSystem, tlsProvider TLSMaterialProvider) *Runtime

func (*Runtime) GenerateAndWriteCert

func (r *Runtime) GenerateAndWriteCert(certFile, keyFile string) (*tls.Config, error)

func (*Runtime) LoadConfigFromEnv

func (r *Runtime) LoadConfigFromEnv() (Config, error)

func (*Runtime) WriteStartupFailureFile

func (r *Runtime) WriteStartupFailureFile(sessionDir string) error

type TLSMaterialProvider

type TLSMaterialProvider interface {
	GeneratePEM() (certPEM []byte, keyPEM []byte, err error)
	TLSConfig(certPEM []byte, keyPEM []byte) (*tls.Config, error)
}

func NewDefaultTLSMaterialProvider

func NewDefaultTLSMaterialProvider() TLSMaterialProvider

Jump to

Keyboard shortcuts

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