skilltest

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SkillTest

type SkillTest struct {
	// contains filtered or unexported fields
}

SkillTest provides test helpers for skill testing with mock SSH.

func New

func New(t *testing.T) *SkillTest

New creates a new SkillTest instance with default configuration.

func (*SkillTest) AssertCommandNotRun

func (pt *SkillTest) AssertCommandNotRun(cmd string)

AssertCommandNotRun verifies that a command was NOT executed.

func (*SkillTest) AssertCommandRun

func (pt *SkillTest) AssertCommandRun(cmd string)

AssertCommandRun verifies that a command was executed.

func (*SkillTest) AssertError

func (pt *SkillTest) AssertError(err error)

AssertError verifies that the error is non-nil.

func (*SkillTest) AssertErrorContains

func (pt *SkillTest) AssertErrorContains(err error, expected string)

AssertErrorContains verifies that the error message contains the expected text.

func (*SkillTest) AssertNoError

func (pt *SkillTest) AssertNoError(err error)

AssertNoError verifies that the error is nil.

func (*SkillTest) AssertResultChanged

func (pt *SkillTest) AssertResultChanged(result types.Result)

AssertResultChanged verifies that the result indicates changes were made.

func (*SkillTest) AssertResultError

func (pt *SkillTest) AssertResultError(result types.Result)

AssertResultError verifies that the result has an error.

func (*SkillTest) AssertResultMessageContains

func (pt *SkillTest) AssertResultMessageContains(result types.Result, expected string)

AssertResultMessageContains verifies that the result message contains the expected text.

func (*SkillTest) AssertResultNoError

func (pt *SkillTest) AssertResultNoError(result types.Result)

AssertResultNoError verifies that the result has no error.

func (*SkillTest) AssertResultUnchanged

func (pt *SkillTest) AssertResultUnchanged(result types.Result)

AssertResultUnchanged verifies that the result indicates no changes were made.

func (*SkillTest) Cleanup

func (pt *SkillTest) Cleanup()

Cleanup restores the default SSH behavior. Should be called in a defer after Setup.

func (*SkillTest) Config

func (pt *SkillTest) Config() types.NodeConfig

Config returns the test configuration.

func (*SkillTest) ExpectCommand

func (pt *SkillTest) ExpectCommand(cmd, output string) *SkillTest

ExpectCommand sets the expected output for a command.

func (*SkillTest) ExpectError

func (pt *SkillTest) ExpectError(cmd string, err error) *SkillTest

ExpectError sets the expected error for a command.

func (*SkillTest) GetCommands

func (pt *SkillTest) GetCommands() []string

GetCommands returns a copy of all executed commands.

func (*SkillTest) MockClient

func (pt *SkillTest) MockClient() *sshtest.MockClient

MockClient returns the mock SSH client for direct manipulation.

func (*SkillTest) Reset

func (pt *SkillTest) Reset()

Reset clears all recorded commands and expectations.

func (*SkillTest) SetArg

func (pt *SkillTest) SetArg(key, value string) *SkillTest

SetArg sets a single argument in the configuration.

func (*SkillTest) SetArgs

func (pt *SkillTest) SetArgs(args map[string]string) *SkillTest

SetArgs replaces the entire arguments map.

func (*SkillTest) SetConfig

func (pt *SkillTest) SetConfig(cfg types.NodeConfig) *SkillTest

SetConfig sets a custom configuration for the test.

func (*SkillTest) Setup

func (pt *SkillTest) Setup() *SkillTest

Setup configures the SSH override to use the mock client. Call this before running any skill that uses SSH. Returns the SkillTest for chaining.

Jump to

Keyboard shortcuts

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