Documentation
ΒΆ
Index ΒΆ
- Variables
- func CamelToSnake(input string) string
- func InitializeConfigScenario(ctx *godog.ScenarioContext)
- func InitializeContextSteps(ctx *godog.ScenarioContext)
- func InitializeEventSteps(ctx *godog.ScenarioContext)
- func InitializeFlagSteps(ctx *godog.ScenarioContext)
- func InitializeProviderSteps(ctx *godog.ScenarioContext)
- func InitializeScenario(ctx *godog.ScenarioContext)
- func SetProviderSuppliers(rpc, inProcess, file ProviderSupplier)
- func StringToBoolean(str string) bool
- func StringToInt(str string) int
- func ToFieldName(option string) string
- func ValueToString(value interface{}) string
- type ContainerDiagnostics
- type ContainerInfo
- type DebugHelper
- func (dh *DebugHelper) FullDiagnostics() map[string]interface{}
- func (dh *DebugHelper) GetContainerDiagnostics() *ContainerDiagnostics
- func (dh *DebugHelper) GetFlagDataInspector() *FlagDataInspector
- func (dh *DebugHelper) GetNetworkDiagnostics() *NetworkDiagnostics
- func (dh *DebugHelper) GetScenarioDebugger() *ScenarioDebugger
- type DebugLogger
- type ErrorAwareProviderConfiguration
- type EvaluationResult
- type EventRecord
- type FlagDataInspector
- type FlagdContainerConfig
- type FlagdTestContainer
- func (f *FlagdTestContainer) GetContainerLogs(ctx context.Context) (string, error)
- func (f *FlagdTestContainer) GetHost() string
- func (f *FlagdTestContainer) GetInfo(ctx context.Context) (*ContainerInfo, error)
- func (f *FlagdTestContainer) GetLaunchpadURL() string
- func (f *FlagdTestContainer) GetPort(service string) int
- func (f *FlagdTestContainer) IsHealthy() bool
- func (f *FlagdTestContainer) Restart(delaySeconds int) error
- func (f *FlagdTestContainer) Start() error
- func (f *FlagdTestContainer) StartFlagdWithConfig(config string) error
- func (f *FlagdTestContainer) Stop() error
- func (f *FlagdTestContainer) StopFlagd() error
- func (f *FlagdTestContainer) Terminate() error
- func (f *FlagdTestContainer) TriggerFlagChange() error
- type NetworkDiagnostics
- type ProviderOption
- type ProviderSupplier
- type ProviderType
- type ScenarioDebugger
- type TestContainer
- type TestState
- type TestStateKey
- type TestbedConfig
- type TestbedRunner
- type ValueConverter
Constants ΒΆ
This section is empty.
Variables ΒΆ
var DebugMode = os.Getenv("FLAGD_E2E_DEBUG") == "true"
DebugMode controls verbose debugging output
var DefaultConverter = NewValueConverter()
Global converter instance
Functions ΒΆ
func CamelToSnake ΒΆ
CamelToSnake converts CamelCase to snake_case
func InitializeConfigScenario ΒΆ
func InitializeConfigScenario(ctx *godog.ScenarioContext)
InitializeConfigScenario initializes the config test scenario
func InitializeContextSteps ΒΆ added in v1.5.1
func InitializeContextSteps(ctx *godog.ScenarioContext)
initializeContextSteps registers evaluation context step definitions
func InitializeEventSteps ΒΆ added in v1.5.1
func InitializeEventSteps(ctx *godog.ScenarioContext)
InitializeEventSteps registers event handling step definitions
func InitializeFlagSteps ΒΆ added in v1.5.1
func InitializeFlagSteps(ctx *godog.ScenarioContext)
InitializeFlagSteps registers flag evaluation step definitions
func InitializeProviderSteps ΒΆ added in v1.5.1
func InitializeProviderSteps(ctx *godog.ScenarioContext)
InitializeProviderSteps registers provider lifecycle step definitions
func InitializeScenario ΒΆ
func InitializeScenario(ctx *godog.ScenarioContext)
InitializeScenario registers all step definitions for gherkin scenarios
func SetProviderSuppliers ΒΆ
func SetProviderSuppliers(rpc, inProcess, file ProviderSupplier)
SetProviderSuppliers sets the provider creation functions
func StringToBoolean ΒΆ
StringToBoolean converts string to boolean with error handling
func StringToInt ΒΆ
StringToInt converts string to int with error handling
func ToFieldName ΒΆ
ToFieldName converts option name to Go field name (capitalize first letter)
func ValueToString ΒΆ
func ValueToString(value interface{}) string
ValueToString converts any value to its string representation
Types ΒΆ
type ContainerDiagnostics ΒΆ
type ContainerDiagnostics struct {
// contains filtered or unexported fields
}
ContainerDiagnostics provides comprehensive container debugging
func NewContainerDiagnostics ΒΆ
func NewContainerDiagnostics(container TestContainer) *ContainerDiagnostics
func (*ContainerDiagnostics) HealthCheck ΒΆ
func (cd *ContainerDiagnostics) HealthCheck() map[string]interface{}
HealthCheck performs comprehensive health diagnostics
func (*ContainerDiagnostics) PrintContainerInfo ΒΆ
func (cd *ContainerDiagnostics) PrintContainerInfo()
PrintContainerInfo displays comprehensive container information
func (*ContainerDiagnostics) PrintContainerLogs ΒΆ
func (cd *ContainerDiagnostics) PrintContainerLogs(lines int)
PrintContainerLogs streams recent container logs
type ContainerInfo ΒΆ
type ContainerInfo struct {
ID string
Image string
Host string
RPCPort int
InProcessPort int
LaunchpadPort int
HealthPort int
LaunchpadURL string
IsRunning bool
IsHealthy bool
}
ContainerInfo provides information about the running container
type DebugHelper ΒΆ
type DebugHelper struct {
// contains filtered or unexported fields
}
DebugHelper provides high-level debugging functions
func NewDebugHelper ΒΆ
func NewDebugHelper(container TestContainer, flagsDir string) *DebugHelper
func (*DebugHelper) FullDiagnostics ΒΆ
func (dh *DebugHelper) FullDiagnostics() map[string]interface{}
FullDiagnostics runs all available diagnostics
func (*DebugHelper) GetContainerDiagnostics ΒΆ
func (dh *DebugHelper) GetContainerDiagnostics() *ContainerDiagnostics
GetContainerDiagnostics returns the container diagnostics instance
func (*DebugHelper) GetFlagDataInspector ΒΆ
func (dh *DebugHelper) GetFlagDataInspector() *FlagDataInspector
GetFlagDataInspector returns the flag data inspector instance
func (*DebugHelper) GetNetworkDiagnostics ΒΆ
func (dh *DebugHelper) GetNetworkDiagnostics() *NetworkDiagnostics
GetNetworkDiagnostics returns the network diagnostics instance
func (*DebugHelper) GetScenarioDebugger ΒΆ
func (dh *DebugHelper) GetScenarioDebugger() *ScenarioDebugger
GetScenarioDebugger returns the scenario debugger instance
type DebugLogger ΒΆ
type DebugLogger struct {
// contains filtered or unexported fields
}
DebugLogger provides structured debugging output
func NewDebugLogger ΒΆ
func NewDebugLogger(prefix string) *DebugLogger
func (*DebugLogger) PrintJSON ΒΆ
func (d *DebugLogger) PrintJSON(obj interface{}, label string)
func (*DebugLogger) Printf ΒΆ
func (d *DebugLogger) Printf(format string, args ...interface{})
type ErrorAwareProviderConfiguration ΒΆ
type ErrorAwareProviderConfiguration struct {
Configuration *flagd.ProviderConfiguration
Error error
}
ErrorAwareProviderConfiguration contains a ProviderConfiguration and an error
type EvaluationResult ΒΆ
type EvaluationResult struct {
FlagKey string
Value interface{}
Reason openfeature.Reason
Variant string
ErrorCode openfeature.ErrorCode
ErrorMessage string
}
EvaluationResult holds the result of flag evaluation in a generic way
type EventRecord ΒΆ
type EventRecord struct {
Type string
Timestamp time.Time
Details openfeature.EventDetails
}
EventRecord tracks events for verification
type FlagDataInspector ΒΆ
type FlagDataInspector struct {
// contains filtered or unexported fields
}
FlagDataInspector helps debug flag-related issues
func NewFlagDataInspector ΒΆ
func NewFlagDataInspector(flagsDir string) *FlagDataInspector
func (*FlagDataInspector) InspectAllFlags ΒΆ
func (fdi *FlagDataInspector) InspectAllFlags() map[string]interface{}
InspectAllFlags reads and displays the contents of allFlags.json
func (*FlagDataInspector) ListFlagFiles ΒΆ
func (fdi *FlagDataInspector) ListFlagFiles() []string
ListFlagFiles shows all flag files in the directory
type FlagdContainerConfig ΒΆ
type FlagdContainerConfig struct {
Image string
Tag string
Feature string
FlagsDir string
Networks []string
ExtraWaitTime time.Duration
TestbedDir string
}
FlagdContainerConfig holds configuration for the flagd testbed container
type FlagdTestContainer ΒΆ
type FlagdTestContainer struct {
// contains filtered or unexported fields
}
FlagdTestContainer implements the TestContainer interface using testcontainers-go
func NewFlagdContainer ΒΆ
func NewFlagdContainer(ctx context.Context, config FlagdContainerConfig) (*FlagdTestContainer, error)
NewFlagdContainer creates a new flagd testbed container
func (*FlagdTestContainer) GetContainerLogs ΒΆ
func (f *FlagdTestContainer) GetContainerLogs(ctx context.Context) (string, error)
GetContainerLogs returns the container logs for debugging
func (*FlagdTestContainer) GetHost ΒΆ
func (f *FlagdTestContainer) GetHost() string
GetHost returns the container host
func (*FlagdTestContainer) GetInfo ΒΆ
func (f *FlagdTestContainer) GetInfo(ctx context.Context) (*ContainerInfo, error)
GetInfo returns detailed information about the container
func (*FlagdTestContainer) GetLaunchpadURL ΒΆ
func (f *FlagdTestContainer) GetLaunchpadURL() string
GetLaunchpadURL returns the full URL for the launchpad API
func (*FlagdTestContainer) GetPort ΒΆ
func (f *FlagdTestContainer) GetPort(service string) int
GetPort returns the mapped port for a specific service
func (*FlagdTestContainer) IsHealthy ΒΆ
func (f *FlagdTestContainer) IsHealthy() bool
IsHealthy checks if the flagd service is healthy
func (*FlagdTestContainer) Restart ΒΆ
func (f *FlagdTestContainer) Restart(delaySeconds int) error
Restart restarts the flagd service after a delay using the launchpad API
func (*FlagdTestContainer) Start ΒΆ
func (f *FlagdTestContainer) Start() error
Start starts the container (if not already running)
func (*FlagdTestContainer) StartFlagdWithConfig ΒΆ
func (f *FlagdTestContainer) StartFlagdWithConfig(config string) error
StartFlagdWithConfig starts flagd with a specific configuration using launchpad
func (*FlagdTestContainer) Stop ΒΆ
func (f *FlagdTestContainer) Stop() error
Stop stops the container
func (*FlagdTestContainer) StopFlagd ΒΆ
func (f *FlagdTestContainer) StopFlagd() error
StopFlagd stops the flagd service using launchpad
func (*FlagdTestContainer) Terminate ΒΆ
func (f *FlagdTestContainer) Terminate() error
Terminate terminates and removes the container
func (*FlagdTestContainer) TriggerFlagChange ΒΆ
func (f *FlagdTestContainer) TriggerFlagChange() error
TriggerFlagChange triggers a flag configuration change using launchpad
type NetworkDiagnostics ΒΆ
type NetworkDiagnostics struct {
// contains filtered or unexported fields
}
NetworkDiagnostics helps debug connectivity issues
func NewNetworkDiagnostics ΒΆ
func NewNetworkDiagnostics(container TestContainer) *NetworkDiagnostics
func (*NetworkDiagnostics) TestConnectivity ΒΆ
func (nd *NetworkDiagnostics) TestConnectivity() map[string]string
TestConnectivity tests all network endpoints
type ProviderOption ΒΆ
ProviderOption is a struct to store the defined options between steps
type ProviderSupplier ΒΆ
type ProviderSupplier func(state TestState) (openfeature.FeatureProvider, error)
ProviderSupplier is a function type that creates providers
var ( RPCProviderSupplier ProviderSupplier InProcessProviderSupplier ProviderSupplier FileProviderSupplier ProviderSupplier )
Global provider supplier variables
type ProviderType ΒΆ
type ProviderType int
ProviderType represents the type of provider being tested
const ( RPC ProviderType = iota InProcess File )
func (ProviderType) String ΒΆ
func (p ProviderType) String() string
type ScenarioDebugger ΒΆ
type ScenarioDebugger struct {
// contains filtered or unexported fields
}
ScenarioDebugger helps debug individual Gherkin scenarios
func NewScenarioDebugger ΒΆ
func NewScenarioDebugger() *ScenarioDebugger
func (*ScenarioDebugger) DebugScenarioFailure ΒΆ
func (sd *ScenarioDebugger) DebugScenarioFailure(scenarioName string, err error, testState interface{})
DebugScenarioFailure provides context when scenarios fail
type TestContainer ΒΆ
type TestContainer interface {
GetHost() string
GetPort(service string) int
GetLaunchpadURL() string
Start() error
Stop() error
Restart(delaySeconds int) error
IsHealthy() bool
}
TestContainer interface abstracts container operations
type TestState ΒΆ
type TestState struct {
// Provider configuration
EnvVars map[string]string
ProviderType ProviderType
Provider openfeature.FeatureProvider
Client *openfeature.Client
ConfigError error
// Configuration testing state
ProviderOptions []ProviderOption
ProviderConfig ErrorAwareProviderConfiguration
// Evaluation state
LastEvaluation EvaluationResult
EvalContext map[string]interface{}
TargetingKey string
FlagKey string
FlagType string
DefaultValue interface{}
// Event tracking
EventChannel chan EventRecord // Single channel for all events
LastEvent *EventRecord // Store the last received event for multiple step access
// Container/testbed state
Container TestContainer
LaunchpadURL string
FlagDir string
}
TestState holds all test state shared across step definitions
func GetStateFromContext ΒΆ added in v1.5.1
func (*TestState) CleanupEnvironmentVariables ΒΆ
func (s *TestState) CleanupEnvironmentVariables()
cleanupEnvironmentVariables restores original environment variables
func (*TestState) GenerateOpts ΒΆ
func (s *TestState) GenerateOpts() []flagd.ProviderOption
type TestStateKey ΒΆ
type TestStateKey struct{}
TestStateKey is the key used to pass TestState across context.Context
type TestbedConfig ΒΆ added in v1.5.1
type TestbedConfig struct {
ResolverType ProviderType
TestbedDir string
FlagsDir string
TestbedConfig string
ExtraOptions []flagd.ProviderOption
Tag string
Image string
}
TestbedConfig holds configuration for testbed runner
type TestbedRunner ΒΆ added in v1.5.1
TestbedRunner manages testbed-based e2e testing
func NewTestbedRunner ΒΆ added in v1.5.1
func NewTestbedRunner(config TestbedConfig) *TestbedRunner
NewTestbedRunner creates a new testbed-based test runner
func (*TestbedRunner) Cleanup ΒΆ added in v1.5.1
func (tr *TestbedRunner) Cleanup() error
Cleanup releases resources
func (*TestbedRunner) RunGherkinTestsWithSubtests ΒΆ added in v1.5.1
func (tr *TestbedRunner) RunGherkinTestsWithSubtests(t *testing.T, featurePaths []string, tags string) error
RunGherkinTestsWithSubtests executes gherkin tests with individual Go subtests for each scenario This makes each Gherkin scenario appear as a separate test in IntelliJ
func (*TestbedRunner) SetupContainer ΒΆ added in v1.5.1
func (tr *TestbedRunner) SetupContainer(ctx context.Context) error
SetupContainer starts and configures the flagd testbed container
type ValueConverter ΒΆ
type ValueConverter struct{}
ValueConverter provides unified type conversion for test steps
func NewValueConverter ΒΆ
func NewValueConverter() *ValueConverter
NewValueConverter creates a new value converter
func (*ValueConverter) ConvertForSteps ΒΆ
func (vc *ValueConverter) ConvertForSteps(value string, valueType string) (interface{}, error)
ConvertForSteps converts string values to appropriate types for step definitions This is the main conversion function used by step definitions
func (*ValueConverter) ConvertToReflectValue ΒΆ
func (vc *ValueConverter) ConvertToReflectValue(valueType, value string, fieldType reflect.Type) reflect.Value
ConvertToReflectValue converts string values to reflect.Value for configuration