Documentation ¶
Index ¶
- Constants
- func FormatDuration(d time.Duration) string
- func GetHTTPClient() *http.Client
- func HTTPDelete(url string) ([]byte, error)
- func HTTPDeleteWithStatus(url string) ([]byte, int, error)
- func HTTPGet(url string) ([]byte, error)
- func HTTPGetNTimes(url string, n int) ([]byte, error)
- func HTTPGetRaw(url string) (*http.Response, error)
- func HTTPGetRawNTimes(url string, n int) (*http.Response, error)
- func HTTPGetRawWithHeaders(url string, header http.Header) (*http.Response, error)
- func HTTPGetWithStatus(url string) ([]byte, int, error)
- func HTTPGetWithStatusWithData(surl string, data []byte) ([]byte, int, error)
- func HTTPGetWithStatusWithMetadata(url string) ([]byte, int, http.Header, error)
- func HTTPPatch(url string, data []byte) ([]byte, error)
- func HTTPPost(url string, data []byte) ([]byte, error)
- func HTTPPostWithStatus(url string, data []byte) ([]byte, int, error)
- func HealthCheckApps(urls ...string) error
- func InitHTTPClient(allowHTTP2 bool)
- func NewHTTPClient(allowHTTP2 bool) *http.Client
- func SanitizeHTTPURL(url string) string
- func SetupLogs(testName string)
- func TestTargetOS() string
- type SimpleKeyValue
- type StateTransactionKeyValue
Constants ¶
const ( // DefaultProbeTimeout is the a timeout used in HTTPGetNTimes() and // HTTPGetRawNTimes() to avoid cases where early requests hang and // block all subsequent requests. DefaultProbeTimeout = 30 * time.Second )
const (
// Environment variable for setting the target OS where tests are running on.
TargetOsEnvVar = "TARGET_OS"
)
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶ added in v1.8.0
FormatDuration formats the duration in ms
func GetHTTPClient ¶ added in v1.12.0
GetHTTPClient returns the shared httpClient object.
func HTTPDelete ¶
HTTPDelete calls a given URL with the HTTP DELETE method.
func HTTPDeleteWithStatus ¶ added in v1.11.0
HTTPDeleteWithStatus calls a given URL with the HTTP DELETE method.
func HTTPGetNTimes ¶
HTTPGetNTimes calls the url n times and returns the first success or last error.
func HTTPGetRaw ¶
HTTPGetRaw is a helper to make GET request call to url.
func HTTPGetRawNTimes ¶
HTTPGetRawNTimes calls the url n times and returns the first success or last error.
func HTTPGetRawWithHeaders ¶ added in v1.13.0
func HTTPGetWithStatus ¶ added in v1.11.0
HTTPGetWithStatus is a helper to make GET request call to url.
func HTTPGetWithStatusWithData ¶ added in v1.11.0
HTTPGetWithStatusWithData is a helper to make GET request call to url.
func HTTPGetWithStatusWithMetadata ¶ added in v1.12.0
HTTPGetWithStatusWithMetadata is a helper to make GET request call to url.
func HTTPPostWithStatus ¶ added in v0.11.0
HTTPPostWithStatus is a helper to make POST request call to url.
func HealthCheckApps ¶ added in v1.12.0
HealthCheckApps performs healthchecks for multiple apps, waiting for them to be ready.
func InitHTTPClient ¶ added in v1.8.0
func InitHTTPClient(allowHTTP2 bool)
InitHTTPClient inits the shared httpClient object.
func NewHTTPClient ¶ added in v1.9.0
NewHTTPClient initializes a new *http.Client. This should not be used except in rare circumstances. Developers should use the shared httpClient instead to re-use sockets as much as possible.
func SanitizeHTTPURL ¶ added in v1.8.0
SanitizeHTTPURL prepends the prefix "http://" to a URL if not present
func SetupLogs ¶ added in v1.8.0
func SetupLogs(testName string)
SetupLogs sets up the target for the built-in "log" package. Logs are always written to STDOUT. If the DAPR_TEST_LOG_PATH environmental variable is set, logs are also written to a file in that folder.
func TestTargetOS ¶ added in v1.7.0
func TestTargetOS() string
TestTargetOS returns the name of the OS that the tests are targeting (which could be different from the local OS).
Types ¶
type SimpleKeyValue ¶
SimpleKeyValue can be used to simplify code, providing simple key-value pairs.
func GenerateRandomStringKeyValues ¶
func GenerateRandomStringKeyValues(num int) []SimpleKeyValue
GenerateRandomStringKeyValues generates random string key-values pairs.
func GenerateRandomStringKeys ¶
func GenerateRandomStringKeys(num int) []SimpleKeyValue
GenerateRandomStringKeys generates random string keys (values are nil).
func GenerateRandomStringValues ¶
func GenerateRandomStringValues(keyValues []SimpleKeyValue) []SimpleKeyValue
GenerateRandomStringValues sets random string values for the keys passed in.
type StateTransactionKeyValue ¶ added in v0.10.0
StateTransactionKeyValue is a key-value pair with an operation type.