Documentation ¶
Overview ¶
Package testing contains methods to create test data. It's a seaparate package to avoid import cycles. Helper functions can be found in the package `testhelper`.
Index ¶
- Constants
- func AddTestStorageClassToVolumeClaimTemplates(filePath string, class string) (string, error)
- func Apply(namespace string, yamlFilePath string) error
- func CertificateVerify(rootPEM, certPEM []byte, dnsName string) error
- func Create(namespace string, yamlFilePath string) error
- func CreateNamespace(name string) error
- func CreateSecretFromLiteral(namespace string, secretName string, literalValues map[string]string) error
- func Delete(namespace string, yamlFilePath string) error
- func DeleteLabelFilter(namespace string, resourceName string, labelName string) error
- func DeleteNamespace(ns string) error
- func DeleteResource(namespace string, resourceName string, name string) error
- func DeleteSecret(namespace string, secretName string) error
- func DeleteWebhooks(ns string) error
- func GetData(namespace string, resourceName string, name string, templatePath string) ([]byte, error)
- func NewContext() context.Context
- func RestartOperator(namespace string) error
- func RunCommandWithOutput(namespace string, podName string, commandInPod string) (string, error)
- func RunHelmBinaryWithCustomErr(args ...string) error
- func SecretCheckData(namespace string, secretName string, fieldPath string) error
- type Catalog
- func (c *Catalog) AnnotatedPod(name string, annotations map[string]string) corev1.Pod
- func (c *Catalog) AutoErrandExtendedJob(name string) ejv1.ExtendedJob
- func (c *Catalog) BOSHDeploymentWithWrongTypeOps(name, manifestRef string, opsRef string) bdv1.BOSHDeployment
- func (c *Catalog) BOSHManifestCFRouting() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestConfigMapWithTwoInstanceGroups(name string) corev1.ConfigMap
- func (c *Catalog) BOSHManifestWithAbsentBPMInfo() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestWithBPMRelease() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestWithMultiBPMProcesses() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestWithMultiBPMProcessesAndPersistentDisk() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestWithOverriddenBPMInfo() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestWithProviderAndConsumer() (*manifest.Manifest, error)
- func (c *Catalog) BOSHManifestWithoutPersistentDisk() (*manifest.Manifest, error)
- func (c *Catalog) BPMReleaseWithAffinity() (*manifest.Manifest, error)
- func (c *Catalog) BPMReleaseWithAffinityConfigMap(name string) corev1.ConfigMap
- func (c *Catalog) CmdPodTemplate(cmd []string) corev1.PodTemplateSpec
- func (c *Catalog) ConfigPodTemplate() corev1.PodTemplateSpec
- func (c *Catalog) DefaultBOSHDeployment(name, manifestRef string) bdv1.BOSHDeployment
- func (c *Catalog) DefaultBOSHDeploymentWithOps(name, manifestRef string, opsRef string) bdv1.BOSHDeployment
- func (c *Catalog) DefaultBOSHManifest() (*manifest.Manifest, error)
- func (c *Catalog) DefaultBOSHManifestConfigMap(name string) corev1.ConfigMap
- func (c *Catalog) DefaultCA(name string, ca credsgen.Certificate) corev1.Secret
- func (c *Catalog) DefaultConfig() *config.Config
- func (c *Catalog) DefaultConfigMap(name string) corev1.ConfigMap
- func (c *Catalog) DefaultExtendedJob(name string) *ejv1.ExtendedJob
- func (c *Catalog) DefaultExtendedJobWithSucceededJob(name string) (*ejv1.ExtendedJob, *batchv1.Job, *corev1.Pod)
- func (c *Catalog) DefaultExtendedSecret(name string) esv1.ExtendedSecret
- func (c *Catalog) DefaultExtendedStatefulSet(name string) essv1.ExtendedStatefulSet
- func (c *Catalog) DefaultPod(name string) corev1.Pod
- func (c *Catalog) DefaultPodTemplate(name string) corev1.PodTemplateSpec
- func (c *Catalog) DefaultSecret(name string) corev1.Secret
- func (c *Catalog) DefaultStatefulSet(name string) v1beta2.StatefulSet
- func (c *Catalog) DefaultStorageClass(name string) storagev1.StorageClass
- func (c *Catalog) DefaultVolumeClaimTemplates(name string, storageClassName string) []corev1.PersistentVolumeClaim
- func (c *Catalog) DefaultVolumeMount(name string) corev1.VolumeMount
- func (c *Catalog) ElaboratedBOSHManifest() (*manifest.Manifest, error)
- func (c *Catalog) EmptyBOSHDeployment(name, manifestRef string) bdv1.BOSHDeployment
- func (c *Catalog) ErrandExtendedJob(name string) ejv1.ExtendedJob
- func (c *Catalog) ExtendedStatefulSetWithPVC(name, pvcName string, storageClassName string) essv1.ExtendedStatefulSet
- func (c *Catalog) FailingMultiContainerPodTemplate(cmd []string) corev1.PodTemplateSpec
- func (c *Catalog) InterpolateBOSHDeployment(name, manifestRef, opsRef string, secretRef string) bdv1.BOSHDeployment
- func (c *Catalog) InterpolateOpsConfigMap(name string) corev1.ConfigMap
- func (c *Catalog) InterpolateOpsIncorrectSecret(name string) corev1.Secret
- func (c *Catalog) InterpolateOpsSecret(name string) corev1.Secret
- func (c *Catalog) LabeledPod(name string, labels map[string]string) corev1.Pod
- func (c *Catalog) MultiContainerPodTemplate(cmd []string) corev1.PodTemplateSpec
- func (c *Catalog) OwnedReferencesExtendedStatefulSet(name string) essv1.ExtendedStatefulSet
- func (c *Catalog) OwnedReferencesPodTemplate(name string) corev1.PodTemplateSpec
- func (c *Catalog) OwnedReferencesStatefulSet(name string) v1beta2.StatefulSet
- func (c *Catalog) PodTemplateWithLabelsAndMount(name string, labels map[string]string, pvcName string) corev1.PodTemplateSpec
- func (c *Catalog) Sleep1hPodSpec() corev1.PodSpec
- func (c *Catalog) StatefulSetWithPVC(name, pvcName string, storageClassName string) v1beta2.StatefulSet
- func (c *Catalog) StorageClassSecret(name string, class string) corev1.Secret
- func (c *Catalog) WrongExtendedStatefulSet(name string) essv1.ExtendedStatefulSet
- func (c *Catalog) WrongExtendedStatefulSetWithPVC(name, pvcName string, storageClassName string) essv1.ExtendedStatefulSet
- func (c *Catalog) WrongPodTemplate(name string) corev1.PodTemplateSpec
- func (c *Catalog) WrongPodTemplateWithLabelsAndMount(name string, labels map[string]string, pvcName string) corev1.PodTemplateSpec
- func (c *Catalog) WrongStatefulSet(name string) v1beta2.StatefulSet
- func (c *Catalog) WrongStatefulSetWithPVC(name, pvcName string, storageClassName string) v1beta2.StatefulSet
- func (c *Catalog) WrongTypeBOSHDeployment(name, manifestRef string) bdv1.BOSHDeployment
- type ClusterCrd
- type CustomError
- type Kubectl
- func (k *Kubectl) RunCommandWithCheckString(namespace string, podName string, commandInPod string, result string) error
- func (k *Kubectl) SecretExists(namespace string, secretName string) (bool, error)
- func (k *Kubectl) ServiceExists(namespace string, serviceName string) (bool, error)
- func (k *Kubectl) Wait(namespace string, requiredStatus string, resourceName string, ...) error
- func (k *Kubectl) WaitForPVC(namespace string, pvcName string) error
- func (k *Kubectl) WaitForSecret(namespace string, secretName string) error
- func (k *Kubectl) WaitForService(namespace string, serviceName string) error
- func (k *Kubectl) WaitLabelFilter(namespace string, requiredStatus string, resourceName string, labelName string) error
Constants ¶
const (
// CFOperatorRelease is the default cf-operator release name
CFOperatorRelease = "cf-operator"
)
Variables ¶
This section is empty.
Functions ¶
func AddTestStorageClassToVolumeClaimTemplates ¶ added in v0.4.0
AddTestStorageClassToVolumeClaimTemplates adds storage class to the example and returns the new file temporary path
func Apply ¶ added in v0.4.0
Apply updates the resource using kubectl command
func CertificateVerify ¶ added in v0.4.0
CertificateVerify verifies certificate with root certificate.
func Create ¶ added in v0.4.0
Create creates the resource using kubectl command
func CreateNamespace ¶ added in v0.4.0
CreateNamespace create the namespace using kubectl command
func CreateSecretFromLiteral ¶ added in v0.4.0
func CreateSecretFromLiteral(namespace string, secretName string, literalValues map[string]string) error
CreateSecretFromLiteral creates a generic type secret using kubectl command
func Delete ¶ added in v0.4.0
Delete creates the resource using kubectl command
func DeleteLabelFilter ¶ added in v0.4.0
DeleteLabelFilter deletes the resource based on label using kubectl command
func DeleteNamespace ¶ added in v0.4.0
DeleteNamespace removes existing ns
func DeleteResource ¶ added in v0.4.0
DeleteResource deletes the resource using kubectl command
func DeleteSecret ¶ added in v0.4.0
DeleteSecret deletes the namespace using kubectl command
func DeleteWebhooks ¶ added in v0.4.0
DeleteWebhooks removes existing webhookconfiguration and validatingwebhookconfiguration
func GetData ¶ added in v0.4.0
func GetData(namespace string, resourceName string, name string, templatePath string) ([]byte, error)
GetData fetches the specified output by the given templatePath
func NewContext ¶
NewContext returns a non-nil empty context, for usage when it is unclear which context to use. Mostly used in tests.
func RestartOperator ¶ added in v0.4.0
RestartOperator restart Operator Deployment
func RunCommandWithOutput ¶ added in v0.4.0
RunCommandWithOutput runs the command specified in the container and returns output
func RunHelmBinaryWithCustomErr ¶ added in v0.4.0
RunHelmBinaryWithCustomErr executes a desire binary
Types ¶
type Catalog ¶
type Catalog struct{}
Catalog provides several instances for tests
func (*Catalog) AnnotatedPod ¶
AnnotatedPod defines a pod with annotations
func (*Catalog) AutoErrandExtendedJob ¶
func (c *Catalog) AutoErrandExtendedJob(name string) ejv1.ExtendedJob
AutoErrandExtendedJob default values
func (*Catalog) BOSHDeploymentWithWrongTypeOps ¶
func (c *Catalog) BOSHDeploymentWithWrongTypeOps(name, manifestRef string, opsRef string) bdv1.BOSHDeployment
BOSHDeploymentWithWrongTypeOps a deployment CR with wrong type ops
func (*Catalog) BOSHManifestCFRouting ¶ added in v0.3.0
BOSHManifestCFRouting returns a manifest for the CF routing release with an underscore in the name
func (*Catalog) BOSHManifestConfigMapWithTwoInstanceGroups ¶ added in v0.4.0
BOSHManifestConfigMapWithTwoInstanceGroups for tests
func (*Catalog) BOSHManifestWithAbsentBPMInfo ¶ added in v0.3.0
BOSHManifestWithAbsentBPMInfo for data gathering tests
func (*Catalog) BOSHManifestWithBPMRelease ¶ added in v0.3.0
BOSHManifestWithBPMRelease returns a manifest with single BPM configuration
func (*Catalog) BOSHManifestWithMultiBPMProcesses ¶ added in v0.3.0
BOSHManifestWithMultiBPMProcesses returns a manifest with multi BPM configuration
func (*Catalog) BOSHManifestWithMultiBPMProcessesAndPersistentDisk ¶ added in v0.3.0
BOSHManifestWithMultiBPMProcessesAndPersistentDisk returns a manifest with multi BPM configuration and persistent disk
func (*Catalog) BOSHManifestWithOverriddenBPMInfo ¶ added in v0.3.0
BOSHManifestWithOverriddenBPMInfo for data gathering tests
func (*Catalog) BOSHManifestWithProviderAndConsumer ¶
BOSHManifestWithProviderAndConsumer for data gathering tests
func (*Catalog) BOSHManifestWithoutPersistentDisk ¶ added in v0.3.0
BOSHManifestWithoutPersistentDisk returns a manifest with persistent disk declaration
func (*Catalog) BPMReleaseWithAffinity ¶ added in v0.3.1
BPMReleaseWithAffinity returns a manifest with affinity
func (*Catalog) BPMReleaseWithAffinityConfigMap ¶ added in v0.3.1
BPMReleaseWithAffinityConfigMap for tests
func (*Catalog) CmdPodTemplate ¶
func (c *Catalog) CmdPodTemplate(cmd []string) corev1.PodTemplateSpec
CmdPodTemplate returns the spec with a given command for busybox
func (*Catalog) ConfigPodTemplate ¶
func (c *Catalog) ConfigPodTemplate() corev1.PodTemplateSpec
ConfigPodTemplate returns the spec with a given command for busybox
func (*Catalog) DefaultBOSHDeployment ¶
func (c *Catalog) DefaultBOSHDeployment(name, manifestRef string) bdv1.BOSHDeployment
DefaultBOSHDeployment a deployment CR
func (*Catalog) DefaultBOSHDeploymentWithOps ¶
func (c *Catalog) DefaultBOSHDeploymentWithOps(name, manifestRef string, opsRef string) bdv1.BOSHDeployment
DefaultBOSHDeploymentWithOps a deployment CR with ops
func (*Catalog) DefaultBOSHManifest ¶
DefaultBOSHManifest for tests
func (*Catalog) DefaultBOSHManifestConfigMap ¶
DefaultBOSHManifestConfigMap for tests
func (*Catalog) DefaultCA ¶
DefaultCA for use in tests
func (*Catalog) DefaultConfig ¶
DefaultConfig for tests
func (*Catalog) DefaultConfigMap ¶
DefaultConfigMap for tests
func (*Catalog) DefaultExtendedJob ¶
func (c *Catalog) DefaultExtendedJob(name string) *ejv1.ExtendedJob
DefaultExtendedJob default values
func (*Catalog) DefaultExtendedJobWithSucceededJob ¶
func (c *Catalog) DefaultExtendedJobWithSucceededJob(name string) (*ejv1.ExtendedJob, *batchv1.Job, *corev1.Pod)
DefaultExtendedJobWithSucceededJob returns an ExtendedJob and a Job owned by it
func (*Catalog) DefaultExtendedSecret ¶
func (c *Catalog) DefaultExtendedSecret(name string) esv1.ExtendedSecret
DefaultExtendedSecret for use in tests
func (*Catalog) DefaultExtendedStatefulSet ¶
func (c *Catalog) DefaultExtendedStatefulSet(name string) essv1.ExtendedStatefulSet
DefaultExtendedStatefulSet for use in tests
func (*Catalog) DefaultPod ¶
DefaultPod defines a pod with a simple web server useful for testing
func (*Catalog) DefaultPodTemplate ¶
func (c *Catalog) DefaultPodTemplate(name string) corev1.PodTemplateSpec
DefaultPodTemplate defines a pod template with a simple web server useful for testing
func (*Catalog) DefaultSecret ¶
DefaultSecret for tests
func (*Catalog) DefaultStatefulSet ¶
func (c *Catalog) DefaultStatefulSet(name string) v1beta2.StatefulSet
DefaultStatefulSet for use in tests
func (*Catalog) DefaultStorageClass ¶
func (c *Catalog) DefaultStorageClass(name string) storagev1.StorageClass
DefaultStorageClass for use in tests
func (*Catalog) DefaultVolumeClaimTemplates ¶
func (c *Catalog) DefaultVolumeClaimTemplates(name string, storageClassName string) []corev1.PersistentVolumeClaim
DefaultVolumeClaimTemplates for use in tests
func (*Catalog) DefaultVolumeMount ¶
func (c *Catalog) DefaultVolumeMount(name string) corev1.VolumeMount
DefaultVolumeMount for use in tests
func (*Catalog) ElaboratedBOSHManifest ¶
ElaboratedBOSHManifest for data gathering tests
func (*Catalog) EmptyBOSHDeployment ¶
func (c *Catalog) EmptyBOSHDeployment(name, manifestRef string) bdv1.BOSHDeployment
EmptyBOSHDeployment empty deployment CR
func (*Catalog) ErrandExtendedJob ¶
func (c *Catalog) ErrandExtendedJob(name string) ejv1.ExtendedJob
ErrandExtendedJob default values
func (*Catalog) ExtendedStatefulSetWithPVC ¶
func (c *Catalog) ExtendedStatefulSetWithPVC(name, pvcName string, storageClassName string) essv1.ExtendedStatefulSet
ExtendedStatefulSetWithPVC for use in tests
func (*Catalog) FailingMultiContainerPodTemplate ¶
func (c *Catalog) FailingMultiContainerPodTemplate(cmd []string) corev1.PodTemplateSpec
FailingMultiContainerPodTemplate returns a spec with a given command for busybox and a second container which fails
func (*Catalog) InterpolateBOSHDeployment ¶
func (c *Catalog) InterpolateBOSHDeployment(name, manifestRef, opsRef string, secretRef string) bdv1.BOSHDeployment
InterpolateBOSHDeployment a deployment CR
func (*Catalog) InterpolateOpsConfigMap ¶
InterpolateOpsConfigMap for ops interpolate configmap tests
func (*Catalog) InterpolateOpsIncorrectSecret ¶
InterpolateOpsIncorrectSecret for ops interpolate incorrect secret tests
func (*Catalog) InterpolateOpsSecret ¶
InterpolateOpsSecret for ops interpolate secret tests
func (*Catalog) LabeledPod ¶
LabeledPod defines a pod with labels and a simple web server
func (*Catalog) MultiContainerPodTemplate ¶
func (c *Catalog) MultiContainerPodTemplate(cmd []string) corev1.PodTemplateSpec
MultiContainerPodTemplate returns the spec with two containers running a given command for busybox
func (*Catalog) OwnedReferencesExtendedStatefulSet ¶
func (c *Catalog) OwnedReferencesExtendedStatefulSet(name string) essv1.ExtendedStatefulSet
OwnedReferencesExtendedStatefulSet for use in tests
func (*Catalog) OwnedReferencesPodTemplate ¶
func (c *Catalog) OwnedReferencesPodTemplate(name string) corev1.PodTemplateSpec
OwnedReferencesPodTemplate defines a pod template with four references from VolumeSources, EnvFrom and Env
func (*Catalog) OwnedReferencesStatefulSet ¶
func (c *Catalog) OwnedReferencesStatefulSet(name string) v1beta2.StatefulSet
OwnedReferencesStatefulSet for use in tests
func (*Catalog) PodTemplateWithLabelsAndMount ¶
func (c *Catalog) PodTemplateWithLabelsAndMount(name string, labels map[string]string, pvcName string) corev1.PodTemplateSpec
PodTemplateWithLabelsAndMount defines a pod template with a simple web server useful for testing
func (*Catalog) Sleep1hPodSpec ¶
Sleep1hPodSpec defines a simple pod that sleeps 60*60s for testing
func (*Catalog) StatefulSetWithPVC ¶
func (c *Catalog) StatefulSetWithPVC(name, pvcName string, storageClassName string) v1beta2.StatefulSet
StatefulSetWithPVC for use in tests
func (*Catalog) StorageClassSecret ¶ added in v0.3.1
StorageClassSecret for tests
func (*Catalog) WrongExtendedStatefulSet ¶
func (c *Catalog) WrongExtendedStatefulSet(name string) essv1.ExtendedStatefulSet
WrongExtendedStatefulSet for use in tests
func (*Catalog) WrongExtendedStatefulSetWithPVC ¶
func (c *Catalog) WrongExtendedStatefulSetWithPVC(name, pvcName string, storageClassName string) essv1.ExtendedStatefulSet
WrongExtendedStatefulSetWithPVC for use in tests
func (*Catalog) WrongPodTemplate ¶
func (c *Catalog) WrongPodTemplate(name string) corev1.PodTemplateSpec
WrongPodTemplate defines a pod template with a simple web server useful for testing
func (*Catalog) WrongPodTemplateWithLabelsAndMount ¶
func (c *Catalog) WrongPodTemplateWithLabelsAndMount(name string, labels map[string]string, pvcName string) corev1.PodTemplateSpec
WrongPodTemplateWithLabelsAndMount defines a pod template with a simple web server useful for testing
func (*Catalog) WrongStatefulSet ¶
func (c *Catalog) WrongStatefulSet(name string) v1beta2.StatefulSet
WrongStatefulSet for use in tests
func (*Catalog) WrongStatefulSetWithPVC ¶
func (c *Catalog) WrongStatefulSetWithPVC(name, pvcName string, storageClassName string) v1beta2.StatefulSet
WrongStatefulSetWithPVC for use in tests
func (*Catalog) WrongTypeBOSHDeployment ¶
func (c *Catalog) WrongTypeBOSHDeployment(name, manifestRef string) bdv1.BOSHDeployment
WrongTypeBOSHDeployment a deployment CR containing wrong type
type ClusterCrd ¶ added in v0.4.0
type ClusterCrd struct { Items []struct { APIVersion string `json:"apiVersion"` Kind string `json:"kind"` Metadata struct { Name string `json:"name"` } `json:"metadata"` } `json:"items"` }
ClusterCrd defines a list of CRDs
func (*ClusterCrd) ContainsElement ¶ added in v0.4.0
func (c *ClusterCrd) ContainsElement(element string) bool
ContainsElement verify if a CRD exist
type CustomError ¶ added in v0.4.0
CustomError containing stdOutput of a binary execution
func (*CustomError) Error ¶ added in v0.4.0
func (e *CustomError) Error() string
type Kubectl ¶ added in v0.2.0
type Kubectl struct { Log *zap.SugaredLogger Namespace string PollTimeout time.Duration // contains filtered or unexported fields }
Kubectl is used as a command to test e2e tests
func NewKubectl ¶ added in v0.2.0
func NewKubectl() *Kubectl
NewKubectl returns a new CfOperatorkubectl command
func (*Kubectl) RunCommandWithCheckString ¶ added in v0.2.0
func (k *Kubectl) RunCommandWithCheckString(namespace string, podName string, commandInPod string, result string) error
RunCommandWithCheckString runs the command specified helperin the container
func (*Kubectl) SecretExists ¶ added in v0.2.2
SecretExists returns true if the pod by that name is in state running
func (*Kubectl) ServiceExists ¶ added in v0.4.0
ServiceExists returns true if the pod by that name is in state running
func (*Kubectl) Wait ¶ added in v0.2.0
func (k *Kubectl) Wait(namespace string, requiredStatus string, resourceName string, customTimeout time.Duration) error
Wait waits for the condition on the resource using kubectl command
func (*Kubectl) WaitForPVC ¶ added in v0.3.0
WaitForPVC blocks until the pvc is available. It fails after the timeout.
func (*Kubectl) WaitForSecret ¶ added in v0.2.2
WaitForSecret blocks until the secret is available. It fails after the timeout.
func (*Kubectl) WaitForService ¶ added in v0.4.0
WaitForService blocks until the service is available. It fails after the timeout.
Directories ¶
Path | Synopsis |
---|---|
Package boshmanifest contains text assets for BOSH manifests and ops files
|
Package boshmanifest contains text assets for BOSH manifests and ops files |