Documentation
¶
Overview ¶
Copyright (C) 2025, Dione Limited. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- func CheckRoles(roles []SupportedRole) error
- func GenerateStakingFiles(keyPath string) (ids.NodeID, error)
- func GetPublicKeyFromSSHKey(keyPath string) (string, error)
- func NewNodeConnection(h *Node, port uint) (*goph.Client, error)
- type MockLogger
- type Node
- func (h *Node) BuildDockerImage(image string, path string, dockerfile string) error
- func (h *Node) BuildDockerImageFromGitRepo(image string, gitRepo string, commit string) error
- func (h *Node) Cmd(ctx context.Context, name string, script string) (*goph.Cmd, error)
- func (h *Node) Command(env []string, timeout time.Duration, script string) ([]byte, error)
- func (h *Node) Commandf(env []string, timeout time.Duration, format string, args ...interface{}) ([]byte, error)
- func (h *Node) ComposeOverSSH(composeDesc string, timeout time.Duration, composePath string, ...) error
- func (h *Node) ComposeSSHSetupLoadTest() error
- func (h *Node) ComposeSSHSetupMonitoring() error
- func (h *Node) ComposeSSHSetupNode(networkID string, subnetsToTrack []string, odysseyGoVersion string, ...) error
- func (h *Node) Connect(port uint) error
- func (h *Node) Connected() bool
- func (h *Node) CreateTempDir() (string, error)
- func (h *Node) CreateTempFile() (string, error)
- func (h *Node) Destroy(ctx context.Context) error
- func (h *Node) Disconnect() error
- func (h *Node) DockerLocalImageExists(image string) (bool, error)
- func (h *Node) Download(remoteFile string, localFile string, timeout time.Duration) error
- func (h *Node) ExpandHome(path string) string
- func (h *Node) FileExists(path string) (bool, error)
- func (h *Node) Forward(httpRequest string, timeout time.Duration) ([]byte, error)
- func (h *Node) GetBLSKeyFromRemoteHost() error
- func (h *Node) GetConnection() *goph.Client
- func (h *Node) GetDockerImageVersion(image string, timeout time.Duration) (string, error)
- func (h *Node) GetOdysseyGoConfigData() (map[string]interface{}, error)
- func (h *Node) GetOdysseyGoHealth() (bool, error)
- func (h *Node) GetOdysseyGoNetworkName() (string, error)
- func (h *Node) GetOdysseyGoVersion() (string, error)
- func (h *Node) GetRemoteComposeContent(composeFile string, timeout time.Duration) (string, error)
- func (h *Node) GetSSHClient() *ssh.Client
- func (h *Node) HasRemoteComposeService(composeFile string, service string, timeout time.Duration) (bool, error)
- func (h *Node) HasSystemDAvailable() bool
- func (h *Node) InitDockerComposeService(composeFile string, service string, timeout time.Duration) error
- func (h *Node) ListDockerComposeImages(composeFile string, timeout time.Duration) (map[string]string, error)
- func (h *Node) ListRemoteComposeServices(composeFile string, timeout time.Duration) ([]string, error)
- func (h *Node) MergeComposeFiles(currentComposeFile string, newComposeFile string) error
- func (h *Node) MkdirAll(remoteDir string, timeout time.Duration) error
- func (h *Node) MonitorNodes(ctx context.Context, targets []Node, chainID string) error
- func (h *Node) OdysseygoRPCClient() (*rpc.Client, error)
- func (h *Node) OdysseygoTCPClient() (*net.Conn, error)
- func (h *Node) ParseRemoteComposeContent(composeFile string, pattern string, timeout time.Duration) (string, error)
- func (h *Node) Post(path string, requestBody string) ([]byte, error)
- func (h *Node) PrepareDockerImageWithRepo(image string, gitRepo string, commit string) error
- func (h *Node) ProvideStakingFiles(keyPath string) error
- func (h *Node) PullDockerImage(image string) error
- func (h *Node) PushComposeFile(localFile string, remoteFile string, merge bool) error
- func (h *Node) ReadFileBytes(remoteFile string, timeout time.Duration) ([]byte, error)
- func (h *Node) Remove(path string, recursive bool) error
- func (h *Node) RestartDockerCompose(timeout time.Duration) error
- func (h *Node) RestartDockerComposeService(composeFile string, service string, timeout time.Duration) error
- func (h *Node) RunOverSSH(scriptDesc string, timeout time.Duration, scriptPath string, ...) error
- func (h *Node) RunSSHCopyMonitoringDashboards(monitoringDashboardPath string) error
- func (h *Node) RunSSHGetNewSubnetEVMRelease(subnetEVMReleaseURL, subnetEVMArchive string) error
- func (h *Node) RunSSHRenderOdysseyNodeConfig(networkID string, trackSubnets []string) error
- func (h *Node) RunSSHRestartOdysseygo() error
- func (h *Node) RunSSHSetupDockerService() error
- func (h *Node) RunSSHSetupLokiConfig(port int) error
- func (h *Node) RunSSHSetupMonitoringFolders() error
- func (h *Node) RunSSHSetupNode() error
- func (h *Node) RunSSHSetupPrometheusConfig(odysseyGoPorts, machinePorts, loadTestPorts []string) error
- func (h *Node) RunSSHSetupPromtailConfig(lokiIP string, lokiPort int, nodeID string, chainID string) error
- func (h *Node) RunSSHStartOdysseygo() error
- func (h *Node) RunSSHStopOdysseygo() error
- func (h *Node) RunSSHUpgradeOdysseygo(odysseyGoVersion string) error
- func (h *Node) RunSSHUpgradeSubnetEVM(subnetEVMBinaryPath string) error
- func (h *Node) RunSSHUploadStakingFiles(keyPath string) error
- func (h *Node) StartDockerCompose(timeout time.Duration) error
- func (h *Node) StartDockerComposeService(composeFile string, service string, timeout time.Duration) error
- func (h *Node) StopDockerCompose(timeout time.Duration) error
- func (h *Node) StopDockerComposeService(composeFile string, service string, timeout time.Duration) error
- func (h *Node) StreamSSHCommand(env []string, timeout time.Duration, command string) error
- func (h *Node) SyncSubnets(subnetsToTrack []string) error
- func (h *Node) UntimedForward(httpRequest string) ([]byte, error)
- func (h *Node) UntimedMkdirAll(remoteDir string) error
- func (h *Node) Upload(localFile string, remoteFile string, timeout time.Duration) error
- func (h *Node) UploadBytes(data []byte, remoteFile string, timeout time.Duration) error
- func (h *Node) ValidateComposeFile(composeFile string, timeout time.Duration) error
- func (h *Node) ValidatePrimaryNetwork(network odyssey.Network, ...) (ids.ID, error)
- func (h *Node) WaitForOdysseyGoHealth(timeout time.Duration) error
- func (h *Node) WaitForPort(port uint, timeout time.Duration) error
- func (h *Node) WaitForSSHShell(timeout time.Duration) error
- func (h *Node) WasNodeSetupWithMonitoring() (bool, error)
- type NodeParams
- type NodeResult
- type NodeResults
- func (nr *NodeResults) AddResult(nodeID string, value interface{}, err error)
- func (nr *NodeResults) Error() error
- func (nr *NodeResults) GetErrorHostMap() map[string]error
- func (nr *NodeResults) GetErrorHosts() []string
- func (nr *NodeResults) GetNodeList() []string
- func (nr *NodeResults) GetResultMap() map[string]interface{}
- func (nr *NodeResults) GetResults() []NodeResult
- func (nr *NodeResults) HasErrors() bool
- func (nr *NodeResults) HasNodeIDWithError(nodeID string) bool
- func (nr *NodeResults) Len() int
- type SSHConfig
- type SupportedRole
- type TestHelper
- func (th *TestHelper) AssertCloudParams(cp interface{}, expectedRegion, expectedImageID, expectedInstanceType string)
- func (th *TestHelper) AssertEnvironment(env []string, expectedVars []string)
- func (th *TestHelper) AssertErrorContains(err error, expectedText string)
- func (th *TestHelper) AssertFileContent(content []byte, expected string)
- func (th *TestHelper) AssertNoError(err error)
- func (th *TestHelper) AssertNodeProperties(node Node, expectedNodeID, expectedIP string, expectedRoles []SupportedRole)
- func (th *TestHelper) AssertRoleCombination(roles []SupportedRole, shouldBeValid bool)
- func (th *TestHelper) AssertSSHConfig(config SSHConfig, expectedUser, expectedKeyPath string)
- func (th *TestHelper) AssertTimeoutHandling(operation func(time.Duration) error, timeout time.Duration)
- func (th *TestHelper) CreateTestCloudParams(cloud interface{}) interface{}
- func (th *TestHelper) CreateTestComposeFile() string
- func (th *TestHelper) CreateTestEnvironment() []string
- func (th *TestHelper) CreateTestFileContent() []byte
- func (th *TestHelper) CreateTestGCPCredentials() string
- func (th *TestHelper) CreateTestNetwork() odyssey.Network
- func (th *TestHelper) CreateTestNode() Node
- func (th *TestHelper) CreateTestNodeParams() *NodeParams
- func (th *TestHelper) CreateTestNodeWithCloud(cloud interface{}) Node
- func (th *TestHelper) CreateTestNodeWithRole(role SupportedRole) Node
- func (th *TestHelper) CreateTestNodes(count int) []Node
- func (th *TestHelper) CreateTestSSHConfig() SSHConfig
- func (th *TestHelper) CreateTestSSHKey() string
- func (th *TestHelper) CreateTestSubnetIDs() []string
- func (th *TestHelper) CreateTestTimeout() time.Duration
- func (th *TestHelper) ValidateTestEnvironment()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRoles ¶
func CheckRoles(roles []SupportedRole) error
CheckRoles checks if the combination of roles is valid
func GenerateStakingFiles ¶
GenerateStakingFiles generates the following files: staker.crt, staker.key and signer.key and stores them in the provided directory in argument in local machine
func GetPublicKeyFromSSHKey ¶
GetPublicKeyFromDefaultSSHKey returns the public key from the default SSH key
Types ¶
type MockLogger ¶
type MockLogger struct{}
MockLogger is a mock implementation of odyssey.LeveledLogger for testing
func (*MockLogger) Debugf ¶
func (m *MockLogger) Debugf(format string, args ...interface{})
func (*MockLogger) Errorf ¶
func (m *MockLogger) Errorf(format string, args ...interface{})
func (*MockLogger) Infof ¶
func (m *MockLogger) Infof(format string, args ...interface{})
func (*MockLogger) Warnf ¶
func (m *MockLogger) Warnf(format string, args ...interface{})
type Node ¶
type Node struct {
// NodeID is Odyssey Node ID of the node
NodeID string
// IP address of the node
IP string
// SSH configuration for the node
SSHConfig SSHConfig
// Roles of the node
// Full list of node roles:
// - Validator
// - API
// - AWM Relayer
// - Load Test
// - Monitoring
Roles []SupportedRole
// Logger for node
Logger odyssey.LeveledLogger
// BLS provides a way to aggregate signatures off chain into a single signature that can be efficiently verified on chain.
// For more information about how BLS is used on the O-Chain, please head to https://docs.dione.network/cross-chain/odyssey-warp-messaging/deep-dive#bls-multi-signatures-with-public-key-aggregation
BlsSecretKey *bls.SecretKey
// contains filtered or unexported fields
}
Node is an output of CreateNodes
func CreateNodes ¶
func CreateNodes( ctx context.Context, nodeParams *NodeParams, ) ([]Node, error)
CreateNodes is a placeholder function for node creation. Cloud functionality has been removed from this SDK. This function now returns an error indicating that cloud functionality is not available.
func (*Node) BuildDockerImage ¶
BuildDockerImage builds a docker image on a remote node.
func (*Node) BuildDockerImageFromGitRepo ¶
BuildDockerImageFromGitRepo builds a docker image from a git repo on a remote node.
func (*Node) Commandf ¶
func (h *Node) Commandf(env []string, timeout time.Duration, format string, args ...interface{}) ([]byte, error)
Commandf is a shorthand for Command with a formatted script.
func (*Node) ComposeOverSSH ¶
func (h *Node) ComposeOverSSH( composeDesc string, timeout time.Duration, composePath string, composeVars dockerComposeInputs, ) error
ComposeOverSSH sets up a docker-compose file on a remote node over SSH.
func (*Node) ComposeSSHSetupLoadTest ¶
func (*Node) ComposeSSHSetupMonitoring ¶
ComposeSSHSetupMonitoring sets up monitoring using docker-compose.
func (*Node) ComposeSSHSetupNode ¶
func (h *Node) ComposeSSHSetupNode(networkID string, subnetsToTrack []string, odysseyGoVersion string, withMonitoring bool) error
ComposeSSHSetupNode sets up an OdysseyGo node and dependencies on a remote node over SSH.
func (*Node) CreateTempDir ¶
CreateTempDir creates a temporary directory on the remote server.
func (*Node) CreateTempFile ¶
CreateTemp creates a temporary file on the remote server.
func (*Node) Disconnect ¶
func (*Node) DockerLocalImageExists ¶
DockerLocalImageExists checks if a docker image exists on a remote node.
func (*Node) ExpandHome ¶
ExpandHome expands the ~ symbol to the home directory.
func (*Node) FileExists ¶
FileExists checks if a file exists on the remote server.
func (*Node) GetBLSKeyFromRemoteHost ¶
GetBLSKeyFromRemoteHost gets BLS information from remote host and sets the BlsSecretKey value in Node object
func (*Node) GetConnection ¶
GetConnection returns the SSH connection client for the Node. Returns a pointer to a goph.Client.
func (*Node) GetDockerImageVersion ¶
func (*Node) GetOdysseyGoConfigData ¶
func (*Node) GetOdysseyGoHealth ¶
func (*Node) GetOdysseyGoNetworkName ¶
func (*Node) GetOdysseyGoVersion ¶
func (*Node) GetRemoteComposeContent ¶
GetRemoteComposeContent gets the content of a remote docker-compose file.
func (*Node) GetSSHClient ¶
GetSSHClient returns the SSH client for the Node. Returns a pointer to an ssh.Client.
func (*Node) HasRemoteComposeService ¶
func (h *Node) HasRemoteComposeService(composeFile string, service string, timeout time.Duration) (bool, error)
HasRemoteComposeService checks if a serviceis present in a remote docker-compose file.
func (*Node) HasSystemDAvailable ¶
HasSystemDAvailable checks if systemd is available on a remote host.
func (*Node) InitDockerComposeService ¶
func (*Node) ListDockerComposeImages ¶
func (*Node) ListRemoteComposeServices ¶
func (h *Node) ListRemoteComposeServices(composeFile string, timeout time.Duration) ([]string, error)
ListRemoteComposeServices lists the services in a remote docker-compose file.
func (*Node) MergeComposeFiles ¶
mergeComposeFiles merges two docker-compose files on a remote node.
func (*Node) MonitorNodes ¶
MonitorNodes links all the nodes specified with the monitoring node so that the monitoring host can start tracking the validator nodes metrics and collecting their logs Cloud functionality has been removed from this SDK.
func (*Node) OdysseygoRPCClient ¶
OdysseygoRPCClient returns the RPC client to the node.
func (*Node) OdysseygoTCPClient ¶
OdysseygoTCPClient returns the connection to the node.
func (*Node) ParseRemoteComposeContent ¶
func (h *Node) ParseRemoteComposeContent(composeFile string, pattern string, timeout time.Duration) (string, error)
ParseRemoteComposeContent extracts a value from a remote docker-compose file.
func (*Node) Post ¶
Post sends a POST request to the node at the specified path with the provided body.
func (*Node) PrepareDockerImageWithRepo ¶
PrepareDockerImageWithRepo prepares a docker image on a remote node.
func (*Node) ProvideStakingFiles ¶
ProvideStakingFiles generates the files needed to validate the primary network:
- staker.crt, staker.key, more information can be found at https://docs.dione.network/nodes/validate/how-to-stake#secret-management
- The file containing the node's BLS information: signer.key (more information can be found at https://docs.dione.network/cross-chain/odyssey-warp-messaging/deep-dive#bls-multi-signatures-with-public-key-aggregation)
and stores them in the provided directory in argument in local machine and subsequently uploads these files into the remote host in /home/ubuntu/.odysseygo/staking/ directory
func (*Node) PullDockerImage ¶
PullDockerImage pulls a docker image on a remote node.
func (*Node) PushComposeFile ¶
func (*Node) ReadFileBytes ¶
ReadFileBytes downloads a file from the remote server to a byte array
func (*Node) RestartDockerCompose ¶
func (*Node) RestartDockerComposeService ¶
func (*Node) RunOverSSH ¶
func (h *Node) RunOverSSH( scriptDesc string, timeout time.Duration, scriptPath string, templateVars scriptInputs, ) error
RunOverSSH runs provided script path over ssh. This script can be template as it will be rendered using scriptInputs vars
func (*Node) RunSSHCopyMonitoringDashboards ¶
func (*Node) RunSSHGetNewSubnetEVMRelease ¶
RunSSHGetNewSubnetEVMRelease runs script to download new subnet evm
func (*Node) RunSSHRenderOdysseyNodeConfig ¶
PrepareOdysseygoConfig creates the config files for the OdysseyGo networkID is the ID of the network to be used trackSubnets is the list of subnets to track
func (*Node) RunSSHRestartOdysseygo ¶
RunSSHRestartOdysseygo runs script to restart odysseygo
func (*Node) RunSSHSetupDockerService ¶
RunSSHSetupDockerService runs script to setup docker compose service for CLI
func (*Node) RunSSHSetupLokiConfig ¶
func (*Node) RunSSHSetupMonitoringFolders ¶
RunSSHSetupMonitoringFolders sets up monitoring folders
func (*Node) RunSSHSetupNode ¶
RunSSHSetupNode runs script to setup sdk dependencies on a remote host over SSH.
func (*Node) RunSSHSetupPrometheusConfig ¶
func (*Node) RunSSHSetupPromtailConfig ¶
func (*Node) RunSSHStartOdysseygo ¶
RunSSHStartOdysseygo runs script to start odysseygo
func (*Node) RunSSHStopOdysseygo ¶
RunSSHStopOdysseygo runs script to stop odysseygo
func (*Node) RunSSHUpgradeOdysseygo ¶
RunSSHUpgradeOdysseygo runs script to upgrade odysseygo
func (*Node) RunSSHUpgradeSubnetEVM ¶
RunSSHUpgradeSubnetEVM runs script to upgrade subnet evm
func (*Node) RunSSHUploadStakingFiles ¶
RunSSHUploadStakingFiles uploads staking files to a remote host via SSH.
func (*Node) StartDockerComposeService ¶
func (*Node) StopDockerComposeService ¶
func (*Node) StreamSSHCommand ¶
StreamSSHCommand streams the execution of an SSH command on the node.
func (*Node) SyncSubnets ¶
SyncSubnets reconfigures odysseygo to sync subnets
func (*Node) UntimedForward ¶
UntimedForward forwards the TCP connection to a remote address. Does not support timeouts on the operation.
func (*Node) UntimedMkdirAll ¶
UntimedMkdirAll creates a folder on the remote server. Does not support timeouts on the operation.
func (*Node) UploadBytes ¶
UploadBytes uploads a byte array to a remote file on the host.
func (*Node) ValidateComposeFile ¶
ValidateComposeFile validates a docker-compose file on a remote node.
func (*Node) ValidatePrimaryNetwork ¶
func (h *Node) ValidatePrimaryNetwork( network odyssey.Network, validatorParams validator.PrimaryNetworkValidatorParams, wallet wallet.Wallet, ) (ids.ID, error)
ValidatePrimaryNetwork adds node as primary network validator. It adds the node in the specified network (Testnet / Mainnet / Devnet) and uses the wallet provided in the argument to pay for the transaction fee
func (*Node) WaitForOdysseyGoHealth ¶
WaitForSSHShell waits for the SSH shell to be available on the node within the specified timeout.
func (*Node) WaitForPort ¶
WaitForPort waits for the SSH port to become available on the node.
func (*Node) WaitForSSHShell ¶
WaitForSSHShell waits for the SSH shell to be available on the node within the specified timeout.
func (*Node) WasNodeSetupWithMonitoring ¶
WasNodeSetupWithMonitoring checks if an OdysseyGo node was setup with monitoring on a remote node.
type NodeParams ¶
type NodeParams struct {
// Count is how many Odyssey Nodes to be created during CreateNodes
Count int
// Roles pertain to whether the created node is going to be a Validator / API / Monitoring
// node. See CheckRoles to see which combination of roles for a node is supported.
Roles []SupportedRole
// Network is whether the Validator / API node is meant to track OdysseyGo Primary Network
// in Testnet / Mainnet / Devnet
Network odyssey.Network
// SubnetIDs is the list of subnet IDs that the created nodes will be tracking
// For primary network, it should be empty
SubnetIDs []string
// SSHPrivateKeyPath is the file path to the private key of the SSH key pair that is used
// to gain access to the created nodes
SSHPrivateKeyPath string
// OdysseyGoVersion is the version of Odyssey Go to install in the created node
OdysseyGoVersion string
}
NodeParams is an input for CreateNodes
type NodeResult ¶
type NodeResult struct {
// ID of the host
NodeID string
// Value is the result of the command executed on the host
Value interface{}
// Err is the error that occurred while executing the command on the host
Err error
}
NodeResult is a struct that holds the result of a async command executed on a host
type NodeResults ¶
type NodeResults struct {
Results []NodeResult
Lock sync.Mutex
}
NodeResults is a struct that holds the results of multiple async commands executed on multiple hosts
func (*NodeResults) AddResult ¶
func (nr *NodeResults) AddResult(nodeID string, value interface{}, err error)
AddResult adds a new NodeResult to the NodeResults struct.
Parameters: - nodeID: the ID of the host. - value: the result of the command executed on the host. - err: the error that occurred while executing the command on the host.
func (*NodeResults) Error ¶
func (nr *NodeResults) Error() error
SumError collects and returns the errors with nodeIds if there are errors in the NodeResults.
Returns an error type.
func (*NodeResults) GetErrorHostMap ¶
func (nr *NodeResults) GetErrorHostMap() map[string]error
GetErrorHostMap returns a map of the errors of the NodeResults with the nodeID as the key.
It acquires the lock on the NodeResults and iterates over the Results slice. For each NodeResult, if the Err field is not nil, it adds the NodeID as the key and the error as the value to the hostErrors map. Finally, it releases the lock and returns the hostErrors map.
Returns: - map[string]error: A map with the nodeIDs as keys and the corresponding errors as values.
func (*NodeResults) GetErrorHosts ¶
func (nr *NodeResults) GetErrorHosts() []string
GetErrorHosts returns a list of the nodeIDs of the NodeResults that have errors.
No parameters. Returns a slice of strings.
func (*NodeResults) GetNodeList ¶
func (nr *NodeResults) GetNodeList() []string
GetNodeList returns a list of the nodeIDs of the NodeResults.
No parameters. Returns a slice of strings.
func (*NodeResults) GetResultMap ¶
func (nr *NodeResults) GetResultMap() map[string]interface{}
GetResultMap returns a map of the results of the NodeResults with the nodeID as the key.
It acquires the lock on the NodeResults and iterates over the Results slice. For each NodeResult, it adds the NodeID as the key and the Value as the value to the result map. Finally, it releases the lock and returns the result map.
Returns: - map[string]interface{}: A map with the nodeIDs as keys and the corresponding values as values.
func (*NodeResults) GetResults ¶
func (nr *NodeResults) GetResults() []NodeResult
GetResults returns the results of the NodeResults
No parameters. Returns: - []NodeResult: the results of the NodeResults.
func (*NodeResults) HasErrors ¶
func (nr *NodeResults) HasErrors() bool
HasErrors returns true if the NodeResults has any errors.
It checks the length of the error host map obtained from the GetErrorHostMap() method of the NodeResults struct. If the length is greater than 0, it means that there are errors present, and the function returns true. Otherwise, it returns false.
func (*NodeResults) HasNodeIDWithError ¶
func (nr *NodeResults) HasNodeIDWithError(nodeID string) bool
HasNodeIDWithError checks if a node with the given nodeID has an error.
Parameters: - nodeID: the ID of the node to check.
Return: - bool: true if a node with the given nodeID has an error, false otherwise.
func (*NodeResults) Len ¶
func (nr *NodeResults) Len() int
Len returns the number of results in the NodeResults.
It acquires the lock on the NodeResults and returns the length of the Results slice. The lock is released before the function returns.
Returns: - int: the number of results in the NodeResults.
type SSHConfig ¶
type SSHConfig struct {
// Username to use when connecting to the node
User string
// Path to the private key to use when connecting to the node
// If this is empty, the SSH agent will be used
PrivateKeyPath string
// Parameters to pass to the ssh command.
// See man ssh_config(5) for more information
// By defalult it's StrictHostKeyChecking=no
Params map[string]string // additional parameters to pass to the ssh command
}
SSHConfig contains the configuration for connecting to a node over SSH
type SupportedRole ¶
type SupportedRole int
const ( Validator SupportedRole = iota API Loadtest Monitor )
func NewSupportedRole ¶
func NewSupportedRole(s string) SupportedRole
NewSupportedRole converts a string to a SupportedRole
func (*SupportedRole) String ¶
func (r *SupportedRole) String() string
String returns the string representation of the SupportedRole
type TestHelper ¶
type TestHelper struct {
// contains filtered or unexported fields
}
TestHelper provides utility functions for testing
func NewTestHelper ¶
func NewTestHelper(t *testing.T) *TestHelper
NewTestHelper creates a new TestHelper
func (*TestHelper) AssertCloudParams ¶
func (th *TestHelper) AssertCloudParams(cp interface{}, expectedRegion, expectedImageID, expectedInstanceType string)
AssertCloudParams validates cloud parameters - removed with cloud functionality
func (*TestHelper) AssertEnvironment ¶
func (th *TestHelper) AssertEnvironment(env []string, expectedVars []string)
AssertEnvironment validates environment variables
func (*TestHelper) AssertErrorContains ¶
func (th *TestHelper) AssertErrorContains(err error, expectedText string)
AssertErrorContains checks if an error contains expected text
func (*TestHelper) AssertFileContent ¶
func (th *TestHelper) AssertFileContent(content []byte, expected string)
AssertFileContent validates file content
func (*TestHelper) AssertNoError ¶
func (th *TestHelper) AssertNoError(err error)
AssertNoError checks that there is no error
func (*TestHelper) AssertNodeProperties ¶
func (th *TestHelper) AssertNodeProperties(node Node, expectedNodeID, expectedIP string, expectedRoles []SupportedRole)
AssertNodeProperties validates node properties
func (*TestHelper) AssertRoleCombination ¶
func (th *TestHelper) AssertRoleCombination(roles []SupportedRole, shouldBeValid bool)
AssertRoleCombination validates role combinations
func (*TestHelper) AssertSSHConfig ¶
func (th *TestHelper) AssertSSHConfig(config SSHConfig, expectedUser, expectedKeyPath string)
AssertSSHConfig validates SSH configuration
func (*TestHelper) AssertTimeoutHandling ¶
func (th *TestHelper) AssertTimeoutHandling(operation func(time.Duration) error, timeout time.Duration)
AssertTimeoutHandling checks timeout handling
func (*TestHelper) CreateTestCloudParams ¶
func (th *TestHelper) CreateTestCloudParams(cloud interface{}) interface{}
CreateTestCloudParams creates test cloud parameters for different clouds - removed with cloud functionality
func (*TestHelper) CreateTestComposeFile ¶
func (th *TestHelper) CreateTestComposeFile() string
CreateTestComposeFile creates a temporary docker-compose file for testing
func (*TestHelper) CreateTestEnvironment ¶
func (th *TestHelper) CreateTestEnvironment() []string
CreateTestEnvironment creates test environment variables
func (*TestHelper) CreateTestFileContent ¶
func (th *TestHelper) CreateTestFileContent() []byte
CreateTestFileContent creates test file content
func (*TestHelper) CreateTestGCPCredentials ¶
func (th *TestHelper) CreateTestGCPCredentials() string
CreateTestGCPCredentials creates a temporary GCP credentials file for testing
func (*TestHelper) CreateTestNetwork ¶
func (th *TestHelper) CreateTestNetwork() odyssey.Network
CreateTestNetwork creates a test network
func (*TestHelper) CreateTestNode ¶
func (th *TestHelper) CreateTestNode() Node
CreateTestNode creates a test node with default values
func (*TestHelper) CreateTestNodeParams ¶
func (th *TestHelper) CreateTestNodeParams() *NodeParams
CreateTestNodeParams creates test node parameters
func (*TestHelper) CreateTestNodeWithCloud ¶
func (th *TestHelper) CreateTestNodeWithCloud(cloud interface{}) Node
CreateTestNodeWithCloud creates a test node with specific cloud - removed with cloud functionality
func (*TestHelper) CreateTestNodeWithRole ¶
func (th *TestHelper) CreateTestNodeWithRole(role SupportedRole) Node
CreateTestNodeWithRole creates a test node with specific role
func (*TestHelper) CreateTestNodes ¶
func (th *TestHelper) CreateTestNodes(count int) []Node
CreateTestNodes creates multiple test nodes
func (*TestHelper) CreateTestSSHConfig ¶
func (th *TestHelper) CreateTestSSHConfig() SSHConfig
CreateTestSSHConfig creates test SSH configuration
func (*TestHelper) CreateTestSSHKey ¶
func (th *TestHelper) CreateTestSSHKey() string
CreateTestSSHKey creates a temporary SSH key file for testing
func (*TestHelper) CreateTestSubnetIDs ¶
func (th *TestHelper) CreateTestSubnetIDs() []string
CreateTestSubnetIDs creates test subnet IDs
func (*TestHelper) CreateTestTimeout ¶
func (th *TestHelper) CreateTestTimeout() time.Duration
CreateTestTimeout creates a test timeout
func (*TestHelper) ValidateTestEnvironment ¶
func (th *TestHelper) ValidateTestEnvironment()
ValidateTestEnvironment checks if the test environment is properly set up