Documentation ¶
Index ¶
- Variables
- func CreateArduinoCLIWithEnvironment(t *testing.T) (*Environment, *ArduinoCLI)
- func FindArduinoCLIPath(t *testing.T) *paths.Path
- func FindRepositoryRootPath(t *testing.T) *paths.Path
- type ArduinoCLI
- func (cli *ArduinoCLI) CleanUp()
- func (cli *ArduinoCLI) CopySketch(sketchName string) *paths.Path
- func (cli *ArduinoCLI) Create() *ArduinoCLIInstance
- func (cli *ArduinoCLI) DataDir() *paths.Path
- func (cli *ArduinoCLI) DownloadDir() *paths.Path
- func (cli *ArduinoCLI) GetDefaultEnv() map[string]string
- func (cli *ArduinoCLI) Run(args ...string) ([]byte, []byte, error)
- func (cli *ArduinoCLI) RunWithCustomEnv(env map[string]string, args ...string) ([]byte, []byte, error)
- func (cli *ArduinoCLI) SetValue(key, jsonData string) error
- func (cli *ArduinoCLI) SetWorkingDir(p *paths.Path)
- func (cli *ArduinoCLI) SketchbookDir() *paths.Path
- func (cli *ArduinoCLI) StartDaemon(verbose bool) string
- func (cli *ArduinoCLI) WorkingDir() *paths.Path
- type ArduinoCLIConfig
- type ArduinoCLIInstance
- func (inst *ArduinoCLIInstance) BoardList(timeout time.Duration) (*commands.BoardListResponse, error)
- func (inst *ArduinoCLIInstance) BoardListWatch() (commands.ArduinoCoreService_BoardListWatchClient, error)
- func (inst *ArduinoCLIInstance) Compile(ctx context.Context, fqbn, sketchPath string, warnings string) (commands.ArduinoCoreService_CompileClient, error)
- func (inst *ArduinoCLIInstance) Init(profile string, sketchPath string, respCB func(*commands.InitResponse)) error
- func (inst *ArduinoCLIInstance) LibraryInstall(ctx context.Context, name, version string, ...) (commands.ArduinoCoreService_LibraryInstallClient, error)
- func (inst *ArduinoCLIInstance) LibraryList(ctx context.Context, name, fqbn string, all, updatable bool) (*commands.LibraryListResponse, error)
- func (inst *ArduinoCLIInstance) LibraryUninstall(ctx context.Context, name, version string) (commands.ArduinoCoreService_LibraryUninstallClient, error)
- func (inst *ArduinoCLIInstance) PlatformInstall(ctx context.Context, packager, arch, version string, skipPostInst bool) (commands.ArduinoCoreService_PlatformInstallClient, error)
- func (inst *ArduinoCLIInstance) PlatformList(ctx context.Context) (*commands.PlatformListResponse, error)
- func (inst *ArduinoCLIInstance) PlatformUpgrade(ctx context.Context, packager, arch string, skipPostInst bool) (commands.ArduinoCoreService_PlatformUpgradeClient, error)
- func (inst *ArduinoCLIInstance) UpdateIndex(ctx context.Context, ignoreCustomPackages bool) (commands.ArduinoCoreService_UpdateIndexClient, error)
- type CLISubtests
- type Environment
- func (e *Environment) CleanUp()
- func (env *Environment) HTTPServeFile(port uint16, path *paths.Path) *url.URL
- func (env *Environment) HTTPServeFileError(port uint16, path *paths.Path, code int) *url.URL
- func (e *Environment) RegisterCleanUpCallback(newCleanUp func())
- func (e *Environment) RootDir() *paths.Path
- func (e *Environment) SharedDownloadsDir() *SharedDir
- func (e *Environment) T() *testing.T
- type SharedDir
Constants ¶
This section is empty.
Variables ¶
var ProjectName = "cli"
ProjectName is the prefix used in the test temp files
Functions ¶
func CreateArduinoCLIWithEnvironment ¶
func CreateArduinoCLIWithEnvironment(t *testing.T) (*Environment, *ArduinoCLI)
CreateArduinoCLIWithEnvironment performs the minimum amount of actions to build the default test environment.
func FindArduinoCLIPath ¶
FindArduinoCLIPath returns the path to the arduino-cli executable
func FindRepositoryRootPath ¶
FindRepositoryRootPath returns the repository root path
Types ¶
type ArduinoCLI ¶
type ArduinoCLI struct {
// contains filtered or unexported fields
}
ArduinoCLI is an Arduino CLI client.
func NewArduinoCliWithinEnvironment ¶
func NewArduinoCliWithinEnvironment(env *Environment, config *ArduinoCLIConfig) *ArduinoCLI
NewArduinoCliWithinEnvironment creates a new Arduino CLI client inside the given environment.
func (*ArduinoCLI) CleanUp ¶
func (cli *ArduinoCLI) CleanUp()
CleanUp closes the Arduino CLI client.
func (*ArduinoCLI) CopySketch ¶
func (cli *ArduinoCLI) CopySketch(sketchName string) *paths.Path
CopySketch copies a sketch inside the testing environment and returns its path
func (*ArduinoCLI) Create ¶
func (cli *ArduinoCLI) Create() *ArduinoCLIInstance
Create calls the "Create" gRPC method.
func (*ArduinoCLI) DataDir ¶
func (cli *ArduinoCLI) DataDir() *paths.Path
DataDir returns the data directory
func (*ArduinoCLI) DownloadDir ¶
func (cli *ArduinoCLI) DownloadDir() *paths.Path
DownloadDir returns the download directory
func (*ArduinoCLI) GetDefaultEnv ¶
func (cli *ArduinoCLI) GetDefaultEnv() map[string]string
GetDefaultEnv returns a copy of the default execution env used with the Run method.
func (*ArduinoCLI) Run ¶
func (cli *ArduinoCLI) Run(args ...string) ([]byte, []byte, error)
Run executes the given arduino-cli command and returns the output.
func (*ArduinoCLI) RunWithCustomEnv ¶
func (cli *ArduinoCLI) RunWithCustomEnv(env map[string]string, args ...string) ([]byte, []byte, error)
RunWithCustomEnv executes the given arduino-cli command with the given custom env and returns the output.
func (*ArduinoCLI) SetValue ¶
func (cli *ArduinoCLI) SetValue(key, jsonData string) error
SetValue calls the "SetValue" gRPC method.
func (*ArduinoCLI) SetWorkingDir ¶
func (cli *ArduinoCLI) SetWorkingDir(p *paths.Path)
SetWorkingDir sets a new working directory
func (*ArduinoCLI) SketchbookDir ¶
func (cli *ArduinoCLI) SketchbookDir() *paths.Path
SketchbookDir returns the sketchbook directory
func (*ArduinoCLI) StartDaemon ¶
func (cli *ArduinoCLI) StartDaemon(verbose bool) string
StartDaemon starts the Arduino CLI daemon. It returns the address of the daemon.
func (*ArduinoCLI) WorkingDir ¶
func (cli *ArduinoCLI) WorkingDir() *paths.Path
WorkingDir returns the working directory
type ArduinoCLIConfig ¶
type ArduinoCLIConfig struct { ArduinoCLIPath *paths.Path }
ArduinoCLIConfig is the configuration of the ArduinoCLI client
type ArduinoCLIInstance ¶
type ArduinoCLIInstance struct {
// contains filtered or unexported fields
}
ArduinoCLIInstance is an Arduino CLI gRPC instance.
func (*ArduinoCLIInstance) BoardList ¶
func (inst *ArduinoCLIInstance) BoardList(timeout time.Duration) (*commands.BoardListResponse, error)
BoardList calls the "BoardList" gRPC method.
func (*ArduinoCLIInstance) BoardListWatch ¶
func (inst *ArduinoCLIInstance) BoardListWatch() (commands.ArduinoCoreService_BoardListWatchClient, error)
BoardListWatch calls the "BoardListWatch" gRPC method.
func (*ArduinoCLIInstance) Compile ¶
func (inst *ArduinoCLIInstance) Compile(ctx context.Context, fqbn, sketchPath string, warnings string) (commands.ArduinoCoreService_CompileClient, error)
Compile calls the "Compile" gRPC method.
func (*ArduinoCLIInstance) Init ¶
func (inst *ArduinoCLIInstance) Init(profile string, sketchPath string, respCB func(*commands.InitResponse)) error
Init calls the "Init" gRPC method.
func (*ArduinoCLIInstance) LibraryInstall ¶
func (inst *ArduinoCLIInstance) LibraryInstall(ctx context.Context, name, version string, noDeps, noOverwrite, installAsBundled bool) (commands.ArduinoCoreService_LibraryInstallClient, error)
LibraryInstall calls the "LibraryInstall" gRPC method.
func (*ArduinoCLIInstance) LibraryList ¶
func (inst *ArduinoCLIInstance) LibraryList(ctx context.Context, name, fqbn string, all, updatable bool) (*commands.LibraryListResponse, error)
LibraryList calls the "LibraryList" gRPC method.
func (*ArduinoCLIInstance) LibraryUninstall ¶
func (inst *ArduinoCLIInstance) LibraryUninstall(ctx context.Context, name, version string) (commands.ArduinoCoreService_LibraryUninstallClient, error)
LibraryUninstall calls the "LibraryUninstall" gRPC method.
func (*ArduinoCLIInstance) PlatformInstall ¶
func (inst *ArduinoCLIInstance) PlatformInstall(ctx context.Context, packager, arch, version string, skipPostInst bool) (commands.ArduinoCoreService_PlatformInstallClient, error)
PlatformInstall calls the "PlatformInstall" gRPC method.
func (*ArduinoCLIInstance) PlatformList ¶
func (inst *ArduinoCLIInstance) PlatformList(ctx context.Context) (*commands.PlatformListResponse, error)
PlatformList calls the "PlatformList" gRPC method.
func (*ArduinoCLIInstance) PlatformUpgrade ¶
func (inst *ArduinoCLIInstance) PlatformUpgrade(ctx context.Context, packager, arch string, skipPostInst bool) (commands.ArduinoCoreService_PlatformUpgradeClient, error)
PlatformUpgrade calls the "PlatformUpgrade" gRPC method.
func (*ArduinoCLIInstance) UpdateIndex ¶
func (inst *ArduinoCLIInstance) UpdateIndex(ctx context.Context, ignoreCustomPackages bool) (commands.ArduinoCoreService_UpdateIndexClient, error)
UpdateIndex calls the "UpdateIndex" gRPC method.
type CLISubtests ¶
type CLISubtests []struct { Name string Function func(*testing.T, *Environment, *ArduinoCLI) }
CLISubtests is a suite of tests to run under the same integreationtest.Environment
func (CLISubtests) Run ¶
func (testSuite CLISubtests) Run(t *testing.T, env *Environment, cli *ArduinoCLI)
Run runs the test suite as subtests of the current test
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment is a test environment for the test suite.
func NewEnvironment ¶
func NewEnvironment(t *testing.T) *Environment
NewEnvironment creates a new test environment.
func (*Environment) HTTPServeFile ¶
func (env *Environment) HTTPServeFile(port uint16, path *paths.Path) *url.URL
HTTPServeFile spawn an http server that serve a single file. The server is started on the given port. The URL to the file and a cleanup function are returned.
func (*Environment) HTTPServeFileError ¶
func (env *Environment) HTTPServeFileError(port uint16, path *paths.Path, code int) *url.URL
HTTPServeFileError spawns an http server that serves a single file and responds with the given error code.
func (*Environment) RegisterCleanUpCallback ¶
func (e *Environment) RegisterCleanUpCallback(newCleanUp func())
RegisterCleanUpCallback adds a clean up function to the clean up chain
func (*Environment) RootDir ¶
func (e *Environment) RootDir() *paths.Path
RootDir returns the root dir of the environment.
func (*Environment) SharedDownloadsDir ¶
func (e *Environment) SharedDownloadsDir() *SharedDir
SharedDownloadsDir return the shared directory for downloads
type SharedDir ¶
type SharedDir struct {
// contains filtered or unexported fields
}
SharedDir is a directory that is shared between multiple tests.
func NewSharedDir ¶
NewSharedDir creates a new shared directory.