testutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestTimeout = time.Second * 30

	TestInterval = time.Millisecond * 250

	DefaultReplicas = int32(3)

	DefaultTestEndpoint = "http://localhost:8080"

	DefaultGitRepoURL = "https://github.com/test/deployments.git"

	DefaultGitBranch = "main"

	DefaultGitDeployPath = "networkintents"

	DefaultMaxRetries = 3

	DefaultRetryDelay = time.Second * 1

	DefaultHTTPTimeout = 30 * time.Second

	DefaultRequeueAfter = 30 * time.Second

	TestE2NodeSetName = "test-e2nodeset"

	TestNetworkIntentName = "test-networkintent"

	TestNamespacePrefix = "test-ns"

	TestAppLabel = "test-app"

	TestAppName = "test-e2node"

	TestFunctionID = 1

	TestFunctionOID = "1.3.6.1.4.1.1.1.1.1"

	TestServiceModel = "kpm"

	TestFunctionDesc = "Test function"

	TestBandwidth = "100Mbps"

	TestLatency = "10ms"

	TestIntentType = "qos"

	TestPriority = 1
)

Variables

This section is empty.

Functions

func CreateIsolatedNamespace

func CreateIsolatedNamespace(baseName string) string

func CreateTestE2NodeSet

func CreateTestE2NodeSet(name, namespace string, replicas int32) *nephoranv1.E2NodeSet

func CreateTestNamespace

func CreateTestNamespace(ctx context.Context, k8sClient client.Client, namespaceName string) error

func CreateTestNetworkIntent

func CreateTestNetworkIntent(name, namespace string) *nephoranv1.NetworkIntent

func DeleteTestNamespace

func DeleteTestNamespace(ctx context.Context, k8sClient client.Client, namespaceName string) error

func EnsureResourceDeleted

func EnsureResourceDeleted(ctx context.Context, k8sClient client.Client, obj client.Object) error

func EnsureResourceExists

func EnsureResourceExists(ctx context.Context, k8sClient client.Client, obj client.Object) error

func GetCondition

func GetCondition(conditions []metav1.Condition, conditionType string) *metav1.Condition

func GetConditionByType

func GetConditionByType(conditions []metav1.Condition, conditionType string) *metav1.Condition

func GetConditionStatus

func GetConditionStatus(conditions []metav1.Condition, conditionType string) metav1.ConditionStatus

func GetRetryCount

func GetRetryCount(ni *nephoranv1.NetworkIntent, operation string) int

func HasCondition

func HasCondition(conditions []metav1.Condition, conditionType string) bool

func IsConditionFalse

func IsConditionFalse(conditions []metav1.Condition, conditionType string) bool

func IsConditionTrue

func IsConditionTrue(conditions []metav1.Condition, conditionType string) bool

func IsConditionUnknown

func IsConditionUnknown(conditions []metav1.Condition, conditionType string) bool

func WaitForCondition

func WaitForCondition(ctx context.Context, k8sClient client.Client, obj client.Object, conditionCheck func() bool, timeout time.Duration) error

Types

type FakeE2Manager

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

func NewFakeE2Manager

func NewFakeE2Manager() *FakeE2Manager

func (*FakeE2Manager) AddNode

func (f *FakeE2Manager) AddNode(nodeID string, node *e2.E2Node)

func (*FakeE2Manager) DeregisterE2Node

func (f *FakeE2Manager) DeregisterE2Node(ctx context.Context, nodeID string) error

func (*FakeE2Manager) GetConnectionCallCount

func (f *FakeE2Manager) GetConnectionCallCount() int

func (*FakeE2Manager) GetConnections

func (f *FakeE2Manager) GetConnections() map[string]string

func (*FakeE2Manager) GetDeregistrationCallCount

func (f *FakeE2Manager) GetDeregistrationCallCount() int

func (*FakeE2Manager) GetLastProvisionedSpec

func (f *FakeE2Manager) GetLastProvisionedSpec() nephoranv1.E2NodeSetSpec

func (*FakeE2Manager) GetListCallCount

func (f *FakeE2Manager) GetListCallCount() int

func (*FakeE2Manager) GetMetrics

func (f *FakeE2Manager) GetMetrics() *e2.E2Metrics

GetMetrics returns fake E2 metrics for testing

func (*FakeE2Manager) GetNodes

func (f *FakeE2Manager) GetNodes() map[string]*e2.E2Node

func (*FakeE2Manager) GetProvisionCallCount

func (f *FakeE2Manager) GetProvisionCallCount() int

func (*FakeE2Manager) GetRegistrationCallCount

func (f *FakeE2Manager) GetRegistrationCallCount() int

func (*FakeE2Manager) ListE2Nodes

func (f *FakeE2Manager) ListE2Nodes(ctx context.Context) ([]*e2.E2Node, error)

func (*FakeE2Manager) ProvisionNode

func (f *FakeE2Manager) ProvisionNode(ctx context.Context, spec nephoranv1.E2NodeSetSpec) error

func (*FakeE2Manager) RegisterE2Node

func (f *FakeE2Manager) RegisterE2Node(ctx context.Context, nodeID string, ranFunctions []e2.RanFunction) error

func (*FakeE2Manager) Reset

func (f *FakeE2Manager) Reset()

func (*FakeE2Manager) SendControlMessage

func (f *FakeE2Manager) SendControlMessage(ctx context.Context, nodeID string, controlReq *e2.RICControlRequest) (*e2.RICControlAcknowledge, error)

SendControlMessage sends a fake control message for testing

func (*FakeE2Manager) SetShouldFailConnection

func (f *FakeE2Manager) SetShouldFailConnection(fail bool)

func (*FakeE2Manager) SetShouldFailDeregistration

func (f *FakeE2Manager) SetShouldFailDeregistration(fail bool)

func (*FakeE2Manager) SetShouldFailList

func (f *FakeE2Manager) SetShouldFailList(fail bool)

func (*FakeE2Manager) SetShouldFailProvision

func (f *FakeE2Manager) SetShouldFailProvision(fail bool)

func (*FakeE2Manager) SetShouldFailRegistration

func (f *FakeE2Manager) SetShouldFailRegistration(fail bool)

func (*FakeE2Manager) SetupE2Connection

func (f *FakeE2Manager) SetupE2Connection(nodeID string, endpoint string) error

func (*FakeE2Manager) Shutdown

func (f *FakeE2Manager) Shutdown() error

Shutdown gracefully shuts down the fake manager

func (*FakeE2Manager) SubscribeE2

func (f *FakeE2Manager) SubscribeE2(req *e2.E2SubscriptionRequest) (*e2.E2Subscription, error)

SubscribeE2 creates a fake subscription for testing

Jump to

Keyboard shortcuts

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