Documentation
¶
Overview ¶
Package testutils provides utilities and helpers for integration testing.
This package contains helper functions, mock servers, and utilities that are commonly used across integration tests. It follows the same patterns as the main testutils package but focuses on integration testing scenarios.
Index ¶
- func AssertEventuallyTrue(t *testing.T, condition func() bool, timeout time.Duration, message string)
- func SkipIfNoRealProxmox(t *testing.T)
- func SkipIfRealProxmox(t *testing.T)
- func WaitForCondition(t *testing.T, condition func() bool, timeout time.Duration, message string)
- type IntegrationTestConfig
- type MockProxmoxServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEventuallyTrue ¶
func AssertEventuallyTrue(t *testing.T, condition func() bool, timeout time.Duration, message string)
AssertEventuallyTrue asserts that a condition becomes true within a timeout.
func SkipIfNoRealProxmox ¶
SkipIfNoRealProxmox skips the test if not running against real Proxmox.
func SkipIfRealProxmox ¶
SkipIfRealProxmox skips the test if running against real Proxmox.
Types ¶
type IntegrationTestConfig ¶
type IntegrationTestConfig struct {
TempDir string
ConfigFile string
CacheDir string
LogFile string
UseRealProxmox bool
ProxmoxAddr string
ProxmoxUser string
ProxmoxPass string
}
IntegrationTestConfig holds configuration for integration tests.
func NewIntegrationTestConfig ¶
func NewIntegrationTestConfig(t *testing.T) *IntegrationTestConfig
NewIntegrationTestConfig creates a new integration test configuration.
func (*IntegrationTestConfig) CreateTestConfig ¶
func (itc *IntegrationTestConfig) CreateTestConfig() *config.Config
CreateTestConfig creates a test configuration object.
func (*IntegrationTestConfig) CreateTestConfigFile ¶
func (itc *IntegrationTestConfig) CreateTestConfigFile(t *testing.T, configContent string)
CreateTestConfigFile creates a configuration file for testing.
func (*IntegrationTestConfig) SetupIntegrationTest ¶
func (itc *IntegrationTestConfig) SetupIntegrationTest(t *testing.T) (*config.Config, interfaces.Logger, interfaces.Cache, *api.Client)
SetupIntegrationTest sets up a complete integration test environment.
type MockProxmoxServer ¶
MockProxmoxServer creates a mock Proxmox API server for testing.
func NewMockProxmoxServer ¶
func NewMockProxmoxServer() *MockProxmoxServer
NewMockProxmoxServer creates a new mock Proxmox server.
func (*MockProxmoxServer) GetURL ¶
func (m *MockProxmoxServer) GetURL() string
GetURL returns the mock server URL.
func (*MockProxmoxServer) SetResponse ¶
func (m *MockProxmoxServer) SetResponse(path string, response interface{})
SetResponse sets a mock response for a specific endpoint.