Documentation ¶
Index ¶
- Constants
- Variables
- func NoopLogFunc(...any)
- type AddressMappings
- type CookieTracker
- type DockerCompose
- type DockerComposeOption
- type DockerServiceStatus
- type K8sSuite
- func (k *K8sSuite) Apply(ctx context.Context, file string) error
- func (k *K8sSuite) Delete(ctx context.Context, file string) error
- func (k *K8sSuite) MustApply(ctx context.Context, file string)
- func (k *K8sSuite) MustDelete(ctx context.Context, file string)
- func (k *K8sSuite) ReadObjects(file string) []*unstructured.Unstructured
- func (k *K8sSuite) SetupSuite()
- func (k *K8sSuite) WaitForPods(client kubernetes.Interface, namespace, selector string, phase corev1.PodPhase, ...)
- type OIDCTestClient
- func (o *OIDCTestClient) Get(url string) (*http.Response, error)
- func (o *OIDCTestClient) Login(formData map[string]string) (*http.Response, error)
- func (o *OIDCTestClient) Logout() (*http.Response, error)
- func (o *OIDCTestClient) ParseLoginForm(responseBody io.ReadCloser, formID string) error
- func (o *OIDCTestClient) ParseLogoutForm(responseBody io.ReadCloser) error
- func (o *OIDCTestClient) Send(req *http.Request) (*http.Response, error)
- type Option
Constants ¶
const (
// KubeConfig is the path where the e2e test setup generates the kubeconfig file
KubeConfig = "cluster/kubeconfig"
)
Variables ¶
var ( PodReady = corev1.PodCondition{Type: corev1.PodReady, Status: corev1.ConditionTrue} PodInitialized = corev1.PodCondition{Type: corev1.PodInitialized, Status: corev1.ConditionTrue} )
Functions ¶
Types ¶
type AddressMappings ¶
type AddressMappings struct {
// contains filtered or unexported fields
}
AddressMappings is a custom dialer that resolves specific host:port to specific target addresses.
func (*AddressMappings) DialContext ¶
DialContext is a custom dialer that resolves specific host:port to specific target addresses.
type CookieTracker ¶
type CookieTracker struct { Delegate http.RoundTripper Cookies map[string]*http.Cookie }
CookieTracker is a http.RoundTripper that tracks cookies received from the server.
type DockerCompose ¶
type DockerCompose struct {
// contains filtered or unexported fields
}
DockerCompose is a helper to interact with docker compose command
func NewDockerCompose ¶
func NewDockerCompose(opts ...DockerComposeOption) DockerCompose
NewDockerCompose creates a new DockerCompose with the given options
func (DockerCompose) StartDockerService ¶
func (d DockerCompose) StartDockerService(name string) error
StartDockerService starts a docker service or returns an error
func (DockerCompose) StopDockerService ¶
func (d DockerCompose) StopDockerService(name string) error
StopDockerService stops a docker service or returns an error
func (DockerCompose) WaitForDockerService ¶
func (d DockerCompose) WaitForDockerService(name string, status DockerServiceStatus, timeout, tick time.Duration) error
WaitForDockerService waits for a docker service to match a status in the given timeout or returns an error
type DockerComposeOption ¶
type DockerComposeOption func(compose *DockerCompose)
DockerComposeOption is a functional option for DockerCompose initialization
func WithDockerComposeLogFunc ¶
func WithDockerComposeLogFunc(logFunc func(...any)) DockerComposeOption
WithDockerComposeLogFunc sets the log function for the DockerCompose. The default is NoopLogFunc
type DockerServiceStatus ¶
type DockerServiceStatus interface { // Match returns true if the status matches the given docker service status Match(string) bool // String returns a string representation of the status String() string }
DockerServiceStatus is an interface that matches the status of a docker service
var ( // DockerServiceExited is a DockerServiceStatus that matches the state "Exited" DockerServiceExited DockerServiceStatus = containsMatcher{"Exited"} // DockerServiceContainerUp is a DockerServiceStatus that matches the state "Up" DockerServiceContainerUp DockerServiceStatus = containsMatcher{"Up"} // DockerServiceContainerUpAndHealthy is a DockerServiceStatus that matches the state "Up (healthy)" DockerServiceContainerUpAndHealthy DockerServiceStatus = containsMatcher{"(healthy)"} )
type K8sSuite ¶
type K8sSuite struct { suite.Suite Kubeconfig *rest.Config // contains filtered or unexported fields }
K8sSuite is a suite that provides a Kubernetes client and a set of helper methods to interact with the Kubernetes API. Kubernetes tests can crete specific suite types that embeds this one to get access to the Kubernetes client and the helper methods.
func (*K8sSuite) Delete ¶
Delete the resources defined in the given file from the Kubernetes cluster.
func (*K8sSuite) MustApply ¶
MustApply applies the given file to the Kubernetes cluster and fails the test if an error occurs.
func (*K8sSuite) MustDelete ¶
MustDelete deletes the resources defined in the given file from the Kubernetes cluster and fails the test if an error occurs.
func (*K8sSuite) ReadObjects ¶
func (k *K8sSuite) ReadObjects(file string) []*unstructured.Unstructured
ReadObjects reads the given file and returns the list of Kubernetes objects defined in it.
func (*K8sSuite) SetupSuite ¶
func (k *K8sSuite) SetupSuite()
SetupSuite initializes the Kubernetes clients.
func (*K8sSuite) WaitForPods ¶
func (k *K8sSuite) WaitForPods(client kubernetes.Interface, namespace, selector string, phase corev1.PodPhase, condition corev1.PodCondition)
WaitForPods waits for the pods in the given namespace and with the given selector to be in the given phase and condition.
type OIDCTestClient ¶
type OIDCTestClient struct {
// contains filtered or unexported fields
}
OIDCTestClient encapsulates a http.Client and keeps track of the state of the OIDC login process.
func NewOIDCTestClient ¶
func NewOIDCTestClient(opts ...Option) (*OIDCTestClient, error)
NewOIDCTestClient creates a new OIDCTestClient.
func (*OIDCTestClient) Get ¶
func (o *OIDCTestClient) Get(url string) (*http.Response, error)
Get sends a GET request to the specified URL.
func (*OIDCTestClient) Logout ¶
func (o *OIDCTestClient) Logout() (*http.Response, error)
Logout logs out from the IdP.
func (*OIDCTestClient) ParseLoginForm ¶
func (o *OIDCTestClient) ParseLoginForm(responseBody io.ReadCloser, formID string) error
ParseLoginForm parses the HTML response body to get the URL where the login page would post the user-entered credentials.
func (*OIDCTestClient) ParseLogoutForm ¶
func (o *OIDCTestClient) ParseLogoutForm(responseBody io.ReadCloser) error
ParseLogoutForm parses the HTML response body to get the URL where the logout page would post the session logout.
type Option ¶
type Option func(*OIDCTestClient) error
Option is a functional option for configuring the OIDCTestClient.
func WithBaseURL ¶
WithBaseURL configures the OIDCTestClient to use the specified IdP base url. Required when the form action URL is relative. For example the logout one.
func WithCustomAddressMappings ¶
WithCustomAddressMappings configures the OIDCTestClient to resolve specific host:port to specific target addresses.
func WithCustomCA ¶
WithCustomCA configures the OIDCTestClient to use a custom CA bundle to verify certificates.
func WithLoggingOptions ¶
WithLoggingOptions configures the OIDCTestClient to log requests and responses.