testing-crds

module
v0.0.0-...-9094c1a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2018 License: Apache-2.0

README

Testing CRDs

This repo accompanies the talk Testing Kubernetes CRDs at Kubecon Shanghai 2018.

Tests

Test pyramid, unit at the bottom, then integration and end to end at the top

Integration tests with kubebuilder

These tests are generated by kubebuilder and use Ginkgo. They will start a controller process and api server locally.

The test (which hasn't been modified from the default) lives in feline_controller_test.go.

To run these tests:

go test ./pkg/controller/feline
End to end tests

After you have deployed the controller, you can run the integration tests against the current-context cluster in your kube config:

go test -v -count=1 -tags=e2e ./client-go/test
go test -v -count=1 -tags=e2e ./kubebuilder/test

-count=1 is the idiomatic way to disable test caching.

You can override the kubeconfig and context if you'd like:

go test -v -tags=e2e -count=1 ./client-go/test --kubeconfig ~/special/kubeconfig --cluster myspecialcluster

Directories

Path Synopsis
client-go
pkg/apis/cat/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
pkg/client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
pkg/client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
pkg/client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
pkg/client/clientset/versioned/typed/cat/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
pkg/client/clientset/versioned/typed/cat/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
kubebuilder
pkg/apis
Package apis contains Kubernetes API groups.
Package apis contains Kubernetes API groups.
pkg/apis/cat
Package cat contains cat API versions
Package cat contains cat API versions
pkg/apis/cat/v1alpha1
Package v1alpha1 contains API Schema definitions for the cat v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bobcatfish/testing-crds/kubebuilder/pkg/apis/cat +k8s:defaulter-gen=TypeMeta +groupName=cat.bobcatfish.com Package v1alpha1 contains API Schema definitions for the cat v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bobcatfish/testing-crds/kubebuilder/pkg/apis/cat +k8s:defaulter-gen=TypeMeta +groupName=cat.bobcatfish.com
Package v1alpha1 contains API Schema definitions for the cat v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bobcatfish/testing-crds/kubebuilder/pkg/apis/cat +k8s:defaulter-gen=TypeMeta +groupName=cat.bobcatfish.com Package v1alpha1 contains API Schema definitions for the cat v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/bobcatfish/testing-crds/kubebuilder/pkg/apis/cat +k8s:defaulter-gen=TypeMeta +groupName=cat.bobcatfish.com

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL