Documentation
¶
Index ¶
- Constants
- Variables
- func WriteKubeconfig(cfg *rest.Config, rootPath string) (string, error)
- type BaseSuite
- func (b *BaseSuite) BackendFromManifest(manifestPath, manifestName string) *models.Backend
- func (b *BaseSuite) CheckEntryInMapFile(mapFileRelativePath, key, value string) bool
- func (b *BaseSuite) CheckMapContents(mapFileRelativePath, expectedMapPath string) bool
- func (b *BaseSuite) CheckMapFileContents(mapFileRelativePath, expectedMapPath string) bool
- func (b *BaseSuite) CheckRuntimeMapContents(mapFileRelativePath, expectedMapPath string) bool
- func (b *BaseSuite) CleanupFixtures(fixturePath string, manifestNames []string)
- func (b *BaseSuite) CleanupFixturesCheckMapFiles(fixturePath string, manifestNames []string, mapFileRelativePaths []string)
- func (b *BaseSuite) CleanupFixturesInNamespace(fixturePath, namespace string, manifestNames []string)
- func (b *BaseSuite) ConsistentlyNoReload(oldPid string, duration time.Duration)
- func (b *BaseSuite) CreateFixtures(fixturePath string, manifestNames []string)
- func (b *BaseSuite) CreateFixturesInNamespace(fixturePath, namespace string, manifestNames []string)
- func (b *BaseSuite) ExpectAttachedRoute(ctx context.Context, namespace, gwName, listenerName string, ...)
- func (b *BaseSuite) ExpectBackends(ctx context.Context, expectationPath string, expectedBackends []string)
- func (b *BaseSuite) ExpectBackendsDoNotExist(ctx context.Context, backendThatShouldNotExist string)
- func (b *BaseSuite) ExpectCertificates(ctx context.Context, expectedCerts []*models.SslCertificate)
- func (b *BaseSuite) ExpectCrtLists(ctx context.Context, expectedCrtLists map[futils.FilePath][]string)
- func (b *BaseSuite) ExpectFrontends(ctx context.Context, expectationPath string, expectedFrontends []string)
- func (b *BaseSuite) ExpectMapContents(mapFilePath, expectedMapPath string)
- func (b *BaseSuite) ExpectRouteConditionsUpdated(ctx context.Context, namespace, name string, ...)
- func (b *BaseSuite) ExpectServers(backend string, expectedServers []string)
- func (b *BaseSuite) FrontendFromManifest(manifestPath, manifestName string) *models.Frontend
- func (b *BaseSuite) GetMapFileFrom(mapFileRelativePath string) ([]string, error)
- func (b *BaseSuite) SetupSuite(crdRelativePath string, levelsUp int)
- func (b *BaseSuite) TearDownSuite()
- func (b *BaseSuite) Test() IntTest
- func (b *BaseSuite) WaitForNoReloadsAnyMore(overAllDuration time.Duration, ...) string
- func (b *BaseSuite) YamlToConditions(yamlPath string) conditions.Conditions
- func (b *BaseSuite) YamlToListenerStatuses(yamlPath string) []gatewayv1.ListenerStatus
- func (b *BaseSuite) YamlToRouteConditions(yamlPath string) rc.RouteConditions
- type IntTest
Constants ¶
const TestControllerName = "gate.haproxy.org/hug"
const (
TestMapThroughRuntime = true
)
Variables ¶
var StandardMaps = []string{
"domain_wildcard_path_exact.map",
"domain_wildcard_sni.map",
"path_exact.map",
"path_prefix.map",
"path_regex.map",
"sni.map",
}
Functions ¶
Types ¶
type BaseSuite ¶
func (*BaseSuite) BackendFromManifest ¶
func (*BaseSuite) CheckEntryInMapFile ¶ added in v0.8.0
func (*BaseSuite) CheckMapContents ¶ added in v0.8.0
func (*BaseSuite) CheckMapFileContents ¶ added in v0.9.0
func (*BaseSuite) CheckRuntimeMapContents ¶ added in v0.9.0
func (*BaseSuite) CleanupFixtures ¶
func (*BaseSuite) CleanupFixturesCheckMapFiles ¶ added in v0.9.0
func (b *BaseSuite) CleanupFixturesCheckMapFiles(fixturePath string, manifestNames []string, mapFileRelativePaths []string)
CleanupFixturesCheckMapFiles is similar to CleanupFixtures, but it takes an additional argument mapFileRelativePath, which is the path to the map file that should be cleaned up. This is useful for tests that create a map file and then need to clean it up after the test has finished.
Note that CleanupFixturesCheckMapFiles will wait until the map file is empty before returning. This is to ensure that the test does not finish before the cleanup has finished.
func (*BaseSuite) CleanupFixturesInNamespace ¶
func (*BaseSuite) ConsistentlyNoReload ¶ added in v0.9.0
ConsistentlyNoReload executes a check repeatedly for a duration. It t.Fatalf() if the condition ever returns false.
func (*BaseSuite) CreateFixtures ¶
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 (*BaseSuite) ExpectAttachedRoute ¶ added in v0.9.0
func (*BaseSuite) ExpectBackends ¶
func (*BaseSuite) ExpectBackendsDoNotExist ¶
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 (*BaseSuite) ExpectMapContents ¶ added in v0.9.0
func (*BaseSuite) ExpectRouteConditionsUpdated ¶ added in v0.9.0
func (*BaseSuite) ExpectServers ¶ added in v0.9.0
func (*BaseSuite) FrontendFromManifest ¶
func (*BaseSuite) GetMapFileFrom ¶ added in v0.8.0
func (*BaseSuite) SetupSuite ¶
func (*BaseSuite) TearDownSuite ¶
func (b *BaseSuite) TearDownSuite()
func (*BaseSuite) WaitForNoReloadsAnyMore ¶ added in v0.9.0
func (b *BaseSuite) WaitForNoReloadsAnyMore( overAllDuration time.Duration, consistentlyDurationWithoutReloads time.Duration, ) string
WaitForNoReloadsAnyMore checks during an overall overAllDuration That we reach a stable state without reloads for at least consistentlyDurationWithoutReloads We set a timer stabilityTimer and if at any point during the stability window a reload occurs, we reset this timer. If we reach the overAllDuration without a stable window without reload we issue a t.Fatalf()
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
RuntimeSocketPath string
PIDFilePath string
// contains filtered or unexported fields
}