Documentation ¶
Overview ¶
Package testutil provides common helper for tests.
Index ¶
Constants ¶
View Source
const (
// KubeconfigEnv is a environment variable name which points to kubeconfig file which will be used for testing.
KubeconfigEnv = "KUBECONFIG"
)
Variables ¶
This section is empty.
Functions ¶
func CheckStatusCodeOK ¶
func CheckStatusCodeOK(ctx context.Context, t *testing.T, httpClient *http.Client, url string) []byte
CheckStatusCodeOK calls RetryGetRequestAndCheckStatus with a failCondition function checking for any response not equal to 200.
func ContextWithDeadline ¶
ContextWithDeadline returns context with will timeout before t.Deadline().
func RetryGetRequestAndCheckStatus ¶ added in v0.3.0
func RetryGetRequestAndCheckStatus( ctx context.Context, t *testing.T, httpClient *http.Client, url string, failCondition func(statusCode int) bool, ) []byte
RetryGetRequestAndCheckStatus sends GET request to given URL.
If 401 or 403 return code is received, function will retry.
If other return code is received, function will check the failCondition to fail the given test.
Types ¶
type TestEnv ¶
type TestEnv struct { PersonalAPIKey string AccountID string Region string Config string ConfigPath string ServingCertPath string ServingKeyPath string KubeconfigPath string Port string Host string BaseURL string Flags []string ContextTimeout time.Duration StartKubernetes bool Context context.Context RestConfig *rest.Config HTTPClient *http.Client }
TestEnv is a helper struct for accessing data required for integration and e2e tests like API key and to perform common test tasks, like generating clients, parameters for adapter etc.
Click to show internal directories.
Click to hide internal directories.