base

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const TestControllerName = "gate.haproxy.org/hug"

Variables

View Source
var StandardMaps = []string{
	"domain_wildcard_path_exact.map",
	"domain_wildcard_sni.map",
	"path_exact.map",
	"path_prefix.map",
	"path_regex.map",
	"sni.map",
}

Functions

func WriteKubeconfig

func WriteKubeconfig(cfg *rest.Config, rootPath string) (string, error)

WriteKubeconfig writes the given rest.Config to a kubeconfig file. It returns the path to the file and an error if it fails.

Types

type BaseSuite

type BaseSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func (*BaseSuite) BackendFromManifest

func (b *BaseSuite) BackendFromManifest(manifestPath, manifestName string) *models.Backend

func (*BaseSuite) CheckEntryInMapFile added in v0.8.0

func (b *BaseSuite) CheckEntryInMapFile(mapFileRelativePath, key, value string) bool

func (*BaseSuite) CheckMapContents added in v0.8.0

func (b *BaseSuite) CheckMapContents(mapFileRelativePath, expectedMapPath string) bool

func (*BaseSuite) CleanupFixtures

func (b *BaseSuite) CleanupFixtures(fixturePath string, manifestNames []string)

func (*BaseSuite) CleanupFixturesInNamespace

func (b *BaseSuite) CleanupFixturesInNamespace(fixturePath, namespace string, manifestNames []string)

func (*BaseSuite) CreateFixtures

func (b *BaseSuite) CreateFixtures(fixturePath string, manifestNames []string)

CreateFixtures will create all the objects from manifests that are in the fixturePath directory They are created in the test namespace To create in a specific namespace use CreateFixturesInNamespace If manifestNames is empty, it will create all objects that are in the directory If manifestNames, it will create only the objects in manifestNames (a sublist of the files in fixturePath)

func (*BaseSuite) CreateFixturesInNamespace

func (b *BaseSuite) CreateFixturesInNamespace(fixturePath, namespace string, manifestNames []string)

func (*BaseSuite) ExpectBackends

func (b *BaseSuite) ExpectBackends(ctx context.Context, expectationPath string, expectedBackends []string)

func (*BaseSuite) ExpectBackendsDoNotExist

func (b *BaseSuite) ExpectBackendsDoNotExist(ctx context.Context, backendThatShouldNotExist string)

func (*BaseSuite) ExpectCertificates

func (b *BaseSuite) ExpectCertificates(ctx context.Context, expectedCerts []*models.SslCertificate)

For now: only checks the following certificate fields: - StorageName - Subject (for CN) Check is performed using the RUNTIME command on haproxy

func (*BaseSuite) ExpectCrtLists

func (b *BaseSuite) ExpectCrtLists(ctx context.Context, expectedCrtLists map[futils.FilePath][]string)

ExpectCrtLists checks that the crt-list are the expectedCrtLists For now, there is no CN method to get the content of the crt-list : "show ssl crt-list <filename>" The only existing method in CN is "show ssl crt-list" that gives the list of crt-lists So, for now, we check the content of the crt-list from the crt-list file, not from the RUNTIME.

func (*BaseSuite) ExpectFrontends

func (b *BaseSuite) ExpectFrontends(ctx context.Context, expectationPath string, expectedFrontends []string)

func (*BaseSuite) FrontendFromManifest

func (b *BaseSuite) FrontendFromManifest(manifestPath, manifestName string) *models.Frontend

func (*BaseSuite) GetMapFileFrom added in v0.8.0

func (b *BaseSuite) GetMapFileFrom(mapFileRelativePath string) ([]string, error)

func (*BaseSuite) SetupSuite

func (b *BaseSuite) SetupSuite()

func (*BaseSuite) TearDownSuite

func (b *BaseSuite) TearDownSuite()

func (*BaseSuite) Test

func (b *BaseSuite) Test() IntTest

func (*BaseSuite) YamlToConditions

func (b *BaseSuite) YamlToConditions(yamlPath string) conditions.Conditions

func (*BaseSuite) YamlToListenerStatuses

func (b *BaseSuite) YamlToListenerStatuses(yamlPath string) []gatewayv1.ListenerStatus

func (*BaseSuite) YamlToRouteConditions

func (b *BaseSuite) YamlToRouteConditions(yamlPath string) rc.RouteConditions

type IntTest

type IntTest struct {
	Ctx           context.Context
	Client        ctrlruntimeclient.Client
	RuntimeClient runtime.Runtime
	HaproxyClient hapapi.HAProxyClient
	TestEnv       *envtest.Environment

	Namespace     string
	HaproxyCfgDir string
	// contains filtered or unexported fields
}

func NewIntTest

func NewIntTest(t *testing.T) (test IntTest, err error)

func (*IntTest) StartTestEnv

func (test *IntTest) StartTestEnv(t *testing.T)

func (*IntTest) StopTestEnv

func (test *IntTest) StopTestEnv(t *testing.T)

Jump to

Keyboard shortcuts

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