hcloud

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressFamilyDualStack addressFamily = iota
	AddressFamilyIPv6
	AddressFamilyIPv4
)

Variables

This section is empty.

Functions

func RunLoadBalancerTests

func RunLoadBalancerTests(t *testing.T, tests []LoadBalancerTestCase)

func Setenv

func Setenv(t *testing.T, args ...string) func()

Setenv prepares the environment for testing the hcloud-cloud-controller-manager.

func SkipEnv

func SkipEnv(t *testing.T, vars ...string)

SkipEnv skips t if any of the passed vars is not set as an environment variable.

SkipEnv uses os.LookupEnv. The empty string is therefore a valid value.

Types

type LoadBalancerOps

type LoadBalancerOps interface {
	GetByName(ctx context.Context, name string) (*hcloud.LoadBalancer, error)
	GetByID(ctx context.Context, id int) (*hcloud.LoadBalancer, error)
	GetByK8SServiceUID(ctx context.Context, svc *v1.Service) (*hcloud.LoadBalancer, error)
	Create(ctx context.Context, lbName string, service *v1.Service) (*hcloud.LoadBalancer, error)
	Delete(ctx context.Context, lb *hcloud.LoadBalancer) error
	ReconcileHCLB(ctx context.Context, lb *hcloud.LoadBalancer, svc *v1.Service) (bool, error)
	ReconcileHCLBTargets(ctx context.Context, lb *hcloud.LoadBalancer, svc *v1.Service, nodes []*v1.Node, disableIPV6 bool) (bool, error)
	ReconcileHCLBServices(ctx context.Context, lb *hcloud.LoadBalancer, svc *v1.Service) (bool, error)
}

LoadBalancerOps defines the Load Balancer related operations required by the hcloud-cloud-controller-manager.

type LoadBalancerTestCase

type LoadBalancerTestCase struct {
	Name string

	// Defined in test case as needed
	ClusterName                  string
	NetworkID                    int
	ServiceUID                   string
	ServiceAnnotations           map[annotation.Name]interface{}
	DisablePrivateIngressDefault bool
	DisableIPv6Default           bool
	Nodes                        []*v1.Node
	LB                           *hcloud.LoadBalancer
	LBCreateResult               *hcloud.LoadBalancerCreateResult
	Mock                         func(t *testing.T, tt *LoadBalancerTestCase)

	// Defines the actual test
	Perform func(t *testing.T, tt *LoadBalancerTestCase)

	Ctx context.Context // Set to context.Background by run if not defined in test

	// Set by run
	LBOps         *hcops.MockLoadBalancerOps
	LBClient      *mocks.LoadBalancerClient
	ActionClient  *mocks.ActionClient
	LoadBalancers *loadBalancers
	Service       *v1.Service
}

Jump to

Keyboard shortcuts

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