Documentation ¶
Index ¶
- Constants
- Variables
- func Escapelines(logline string) string
- func FailureTimeout() time.Duration
- func GinkgoCurrentTest() (g ginkgo.GinkgoTestDescription, ok bool)
- func GitRoot(paths ...string) string
- func HTMLBodyText(r io.Reader) ([]byte, error)
- func HTTPError(resp *http.Response) error
- func JSONLine(v interface{}) string
- func LogBeginEnd(l logr.Logger, msg string, errp *error, kv ...interface{}) func()
- func MapIndices(m interface{}, index ...interface{}) (value interface{})
- func Must(err error)
- func MustUnmarshal(s string, v interface{})
- func SuccessTimeout() time.Duration
- func TrimLines(lines string) string
- func UniqueName(prefix string) string
- func UniqueNameForTest() string
- func Unmarshal(s string, v interface{}) error
- func Writer() io.Writer
- func YAMLString(v interface{}) string
- type FailGroup
Constants ¶
const ( // DefaultSuccessTimeout for operations that are expected to succeed. DefaultSuccessTimeout = 5 * time.Minute // DefaultFailureTimeout for operations that are *expected* to time out. // // The timeout is short because timeouts are *never* a reliable way to // determine that something does not happen. At best such a test *might* catch // the problem. It is better than nothing, but not by much. Definitely not // worth delaying the entire test suite for. // // Ideally tests for non-happening should have a positive wait with // DefaultSuccessTimeout for something that we know *does* happen, and that we // know never happens *before* the thing we don't expect to happen. Then look // for positive proof that the thing didn't happen. A negative timeout result // never proves that the thing won't happen in 1 more millisecond. // DefaultFailureTimeout = 1 * time.Second OpenshiftOperatorsRedhatNS = "openshift-operators-redhat" )
Variables ¶
var JSONString = utilsjson.MustMarshal
JSONString returns a JSON string of a value, or an error message.
Functions ¶
func Escapelines ¶
func FailureTimeout ¶
func GinkgoCurrentTest ¶
func GinkgoCurrentTest() (g ginkgo.GinkgoTestDescription, ok bool)
GinkgoCurrentTest tries to get the current Ginkgo test description. Returns true if successful, false if not in a ginkgo test.
func GitRoot ¶
GitRoot joins paths to the root of the git repository. Panics if current directory is not inside a git repository.
func HTMLBodyText ¶
HTMLBodyText extracts text from the <body> of a HTML document. Useful for test error messages, not for much else.
func HTTPError ¶
HTTPError returns an error constructed from resp.Body if resp.Status is not 2xx. Returns nil otherwise.
func JSONLine ¶
func JSONLine(v interface{}) string
JSONLine returns a one-line JSON string, or an error message.
func LogBeginEnd ¶
LogBeginEnd logs an l.V(3) begin message, returns func to log an lV(2) end message. End message includes elapsed time and error errp and *errp are non nil. Use it to log the time spent in a function like this:
func blah() (err error) { defer LogBeginEnd(log, "eating", &err)() ...
Note the trailing () - this calls LogBeginEnd() and defers calling the func it returns.
func MapIndices ¶
func MapIndices(m interface{}, index ...interface{}) (value interface{})
MapIndices indexes into a multi-level map[string]interface{} unmarshalled from JSON. Result is like `m[index1][index2]..` Returns nil if an index is not found.
func MustUnmarshal ¶
func MustUnmarshal(s string, v interface{})
MustUnmarshal unmarshals JSON or YAML into a value, panic on error.
func SuccessTimeout ¶
func TrimLines ¶
TrimLines trims leading and trailing whitespace from every line in lines. Useful for comparing configuration snippets with varied indenting.
func UniqueName ¶
UniqueName generates a unique DNS label string starting with prefix. Illegal character sequences in prefix are replaced with "-". Suffix sorts by time of creation if < 12h apart.
func UniqueNameForTest ¶
func UniqueNameForTest() string
UniqueNameForTest generates a unique name for a test.
func Unmarshal ¶
Unmarshal JSON or YAML string into a value according to k8s rules. Uses sigs.k8s.io/yaml.
func Writer ¶
Writer for log or error output from tests when there is nowhere better to send it. Returns GinkgoWriter if available, os.Stderr otherwise.
func YAMLString ¶
func YAMLString(v interface{}) string
YAMLString returns a YAML string of a value, using the sigs.k8s.io/yaml package, or an error message.
Types ¶
type FailGroup ¶
type FailGroup struct {
// contains filtered or unexported fields
}
A FailGroup is a collection of goroutines running concurrently as part of a Ginkgo test. The goroutines may exit by calling ginkgo.Fail(), for example by using Expect(). they may also return an error.
This is essentially errgroup.Group extended to recover ginkgo.Fail() correctly.
Directories ¶
Path | Synopsis |
---|---|
package client provides a client for tests.
|
package client provides a client for tests. |
e2e
|
|
flowcontrol
End-to-End Tests for Log Flow Control LOG-1043: Log Flow Control API Enhancement
|
End-to-End Tests for Log Flow Control LOG-1043: Log Flow Control API Enhancement |
flowcontrol
Functional Tests for Log Flow Control
|
Functional Tests for Log Flow Control |
fluentd
package fluentd provides a fluentd receiver for use in e2e forwarding tests.
|
package fluentd provides a fluentd receiver for use in e2e forwarding tests. |
package runtime provides conveniences based on "k8s.io/apimachinery/pkg/runtime"
|
package runtime provides conveniences based on "k8s.io/apimachinery/pkg/runtime" |