Documentation
¶
Overview ¶
Package runtime exposes process and timing dependencies for command tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLocalNotRunning = errors.New("local development is not running; run 'volcano start' to launch it, or use 'volcano cloud <command>' to target your cloud project")
ErrLocalNotRunning signals that a command needs the local Volcano stack but it isn't up (the server container is absent or stopped). It is already user-actionable, so callers surface it verbatim instead of burying it under a generic wrapper like "failed to load config".
Functions ¶
func CommandPath ¶ added in v0.0.3
CommandPath returns a user-facing command path for the current command tree.
func OpenBrowser ¶
OpenBrowser opens rawURL through the configured browser hook or OpenURL.
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
CommandRunnerFunc adapts a function to CommandRunner.
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)
// LocalMode makes session-built API clients send no credential. Local mode
// is a single-tenant sandbox; the local server defaults an absent credential
// to the pre-provisioned local user. Set by the local command wiring.
LocalMode bool
LocalCommandRunner CommandRunner
UpdateCommandRunner CommandRunner
GitCommandRunner CommandRunner
ExecutablePath string
UpdateDownloadURL string
CommandPathPrefix string
// DocsCacheDir overrides the base cache directory used by `volcano docs`.
// Empty uses os.UserCacheDir()/volcano. Tests inject a t.TempDir().
DocsCacheDir string
// DocsGitHubAPIURL overrides the GitHub API base (default
// https://api.github.com) for docs sync. Tests point this at an httptest
// server.
DocsGitHubAPIURL string
// DocsRawBaseURL selects raw-host downloads (e.g.
// https://raw.githubusercontent.com) for public sources. It is empty by
// default: downloads then go through the authenticated GitHub contents API
// (which also works for private repos). Tests may point it at an httptest
// server to exercise the raw-host path.
DocsRawBaseURL string
// Now overrides the wall clock for deterministic freshness/staleness tests.
Now func() time.Time
}
Deps captures runtime dependencies that command and service tests replace.
Click to show internal directories.
Click to hide internal directories.