Documentation ¶
Index ¶
- Constants
- func DeleteAllOf(g *gomega.GomegaWithT, obj client.Object)
- func DeleteNamespace(g *gomega.GomegaWithT, ns *corev1.Namespace)
- func MakeFakeLogr() (logr.Logger, *fakelogr.LogSink)
- func MakeJWToken(t *testing.T, key *rsa.PrivateKey, email string, opts ...func(map[string]any)) string
- func MakeKeysetServer(t *testing.T, key *rsa.PrivateKey) *httptest.Server
- func MakeRSAPrivateKey(t *testing.T) *rsa.PrivateKey
- func MatchGRPCError(code, err interface{}) types.GomegaMatcher
- func Setenv(k, v string) func()
- type K8sTestEnv
Constants ¶
View Source
const BaseURI = "https://weave.works/api"
Variables ¶
This section is empty.
Functions ¶
func DeleteAllOf ¶ added in v0.8.0
func DeleteAllOf(g *gomega.GomegaWithT, obj client.Object)
DeleteAllOf loops through all namespaces and deletes all resources from the given type
func DeleteNamespace ¶ added in v0.8.0
func DeleteNamespace(g *gomega.GomegaWithT, ns *corev1.Namespace)
DeleteNamespace deletes a namespace. Note: deleting a namespace using this function on tests wont delete the underlying resources like in a real environment would.
func MakeFakeLogr ¶ added in v0.3.0
MakeFakeLogr returns an API compliant logr object that can be used for unit testing.
func MakeJWToken ¶ added in v0.6.1
func MakeJWToken(t *testing.T, key *rsa.PrivateKey, email string, opts ...func(map[string]any)) string
MakeJWToken creates and signs a token with the provided key.
func MakeKeysetServer ¶ added in v0.6.1
MakeKeysetServer starts an HTTP server that can serve JSONWebKey sets.
func MakeRSAPrivateKey ¶ added in v0.6.1
func MakeRSAPrivateKey(t *testing.T) *rsa.PrivateKey
MakeRSAPrivateKey generates and returns an RSA Private Key.
func MatchGRPCError ¶ added in v0.7.0
func MatchGRPCError(code, err interface{}) types.GomegaMatcher
Types ¶
type K8sTestEnv ¶
type K8sTestEnv struct { Env *envtest.Environment Client client.Client DynClient dynamic.Interface RestMapper *restmapper.DeferredDiscoveryRESTMapper Rest *rest.Config Stop func() }
func StartK8sTestEnvironment ¶
func StartK8sTestEnvironment(crdPaths []string) (*K8sTestEnv, error)
Note that crdPaths are relative to the path of the test file, NOT the current working directory or path that the tests were started from.
Click to show internal directories.
Click to hide internal directories.