Documentation ¶
Index ¶
- func ApiserverCert() string
- func ApiserverConfig() *rest.Config
- func ApiserverToken() string
- func ApiserverURL() string
- func EtcdURL() string
- func MustDecodeYAML(yamlStr string, into interface{})
- func TestMain(tests func() int)
- type Fixture
- func (f *Fixture) Client() client.Client
- func (f *Fixture) Context() context.Context
- func (f *Fixture) CreateNamespace(ctx context.Context, namespace string) *corev1.Namespace
- func (f *Fixture) CreateVitessCluster(namespace, name string, vt *planetscalev2.VitessCluster) *planetscalev2.VitessCluster
- func (f *Fixture) CreateVitessClusterYAML(namespace, name, vtYAML string) *planetscalev2.VitessCluster
- func (f *Fixture) ExpectPods(listOpts *client.ListOptions, expectedCount int) *corev1.PodList
- func (f *Fixture) MustGet(namespace, name string, obj client.Object)
- func (f *Fixture) TearDown()
- func (f *Fixture) WaitFor(condition string, check func() error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiserverCert ¶
func ApiserverCert() string
ApiserverCert returns the generated kube-apiserver certificate authority
func ApiserverConfig ¶
ApiserverConfig returns a rest.Config to connect to the test instance.
func ApiserverToken ¶
func ApiserverToken() string
ApiserverToken returns the token used for authentication
func ApiserverURL ¶
func ApiserverURL() string
ApiserverURL returns the URL of the kube-apiserver instance started by TestMain.
func EtcdURL ¶
func EtcdURL() string
EtcdURL returns the URL to connect to the etcd instance launched for this test environment. This can be shared as long as each component uses a unique key prefix.
func MustDecodeYAML ¶
func MustDecodeYAML(yamlStr string, into interface{})
MustDecodeYAML decodes YAML into the given object. It will panic if the decode fails.
Types ¶
type Fixture ¶
Fixture is a collection of scaffolding for each integration test method.
func NewFixture ¶
NewFixture creates a new test fixture. Each Test*() function should create its own fixture and immediately defer a call to that fixture's TearDown() method.
func (*Fixture) CreateNamespace ¶
CreateNamespace creates a namespace that will be deleted after this test finishes.
func (*Fixture) CreateVitessCluster ¶
func (f *Fixture) CreateVitessCluster(namespace, name string, vt *planetscalev2.VitessCluster) *planetscalev2.VitessCluster
CreateVitessCluster creates a VitessCluster that will be deleted after this test finishes.
func (*Fixture) CreateVitessClusterYAML ¶
func (f *Fixture) CreateVitessClusterYAML(namespace, name, vtYAML string) *planetscalev2.VitessCluster
CreateVitessClusterYAML creates a VitessCluster (from YAML input) that will be deleted after this test finishes.
func (*Fixture) ExpectPods ¶
ExpectPods waits up to a default timeout for the given selector to match the expected number of Pods. If the timeout expires, the test is aborted.
func (*Fixture) MustGet ¶
MustGet waits up to a default timeout for the named object to exist and then returns it. If the timeout expires before the object appears, the test is aborted.
func (*Fixture) TearDown ¶
func (f *Fixture) TearDown()
TearDown cleans up resources created through this instance of the test fixture.
func (*Fixture) WaitFor ¶
WaitFor polls the check function until it returns true, with a default interval and timeout. This is meant for use in integration tests, so frequent polling is fine.
The check function should return nil if it is satisfied, or a non-nil error indicating why it's not satisfied.
If the timeout expires before the check function is satisfied, the test will be aborted.