Documentation ¶
Overview ¶
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PrepareCmd = func(cmd *exec.Cmd) Runnable {
return &cmdWithStderr{cmd}
}
PrepareCmd extends exec.Cmd with extra error reporting features and provides a hook to stub command execution in tests
Functions ¶
func BootArgsPrepare ¶ added in v0.6.7
BootArgsPrepare prepares the boot arguments for the unikernel. Because of double parsing we need to be careful to escape each argument with either single or double quotes before merging them together.
Types ¶
type CommandCallback ¶
type CommandCallback func([]string)
type CommandStubber ¶
type CommandStubber struct {
// contains filtered or unexported fields
}
CommandStubber stubs out invocations to external commands.
func Stub ¶
func Stub() (*CommandStubber, func(T))
Stub installs a catch-all for all external commands invoked from kraftkit. It returns a restore func that, when invoked from tests, fails the current test if some stubs that were registered were never matched.
func (*CommandStubber) Register ¶
func (cs *CommandStubber) Register(pattern string, exitStatus int, output string, callbacks ...CommandCallback)
Register a stub for an external command. Pattern is a regular expression, output is the standard output from a command. Pass callbacks to inspect raw arguments that the command was invoked with.