runtime

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package runtime exposes process and timing dependencies for command tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenBrowser

func OpenBrowser(deps Deps, rawURL string) error

OpenBrowser opens rawURL through the configured browser hook or OpenURL.

func OpenURL

func OpenURL(rawURL string) error

OpenURL opens rawURL in the platform default browser.

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

CommandRunner runs an external command.

type CommandRunnerFunc added in v0.0.2

type CommandRunnerFunc func(ctx context.Context, name string, args ...string) ([]byte, error)

CommandRunnerFunc adapts a function to CommandRunner.

func (CommandRunnerFunc) Run added in v0.0.2

func (f CommandRunnerFunc) Run(ctx context.Context, name string, args ...string) ([]byte, error)

Run calls f(ctx, name, args...).

type Deps

type Deps struct {
	HTTPClient apiclient.HttpRequestDoer
	// APIBaseURL overrides the compiled cloud API URL for tests. Synthetic
	// local configs supply their API URL through ConfigLoader instead.
	APIBaseURL          string
	OpenBrowser         func(string) error
	NewTimer            func(time.Duration) Timer
	NewTicker           func(time.Duration) Ticker
	ConfigLoader        func() (*config.Config, error)
	LocalCommandRunner  CommandRunner
	UpdateCommandRunner CommandRunner
	ExecutablePath      string
	UpdateGitHubAPIURL  string
}

Deps captures runtime dependencies that command and service tests replace.

type Ticker

type Ticker interface {
	C() <-chan time.Time
	Reset(time.Duration)
	Stop()
}

Ticker is the subset of time.Ticker used by command services.

func NewTicker

func NewTicker(deps Deps, duration time.Duration) Ticker

NewTicker returns the configured test ticker or a real time.Ticker wrapper.

type Timer

type Timer interface {
	C() <-chan time.Time
	Stop()
}

Timer is the subset of time.Timer used by command services.

func NewTimer

func NewTimer(deps Deps, duration time.Duration) Timer

NewTimer returns the configured test timer or a real time.Timer wrapper.

Jump to

Keyboard shortcuts

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