Documentation ¶
Index ¶
- Constants
- Variables
- func CheckExternalAddress(client HTTPClient, operand version.Operand) bool
- func CreateCrossSiteSingleKeyStoreAndTrustStore() (KeyStore, trustStore []byte)
- func CreateDefaultCrossSiteKeyAndTrustStore() (transportKeyStore, routerKeyStore, trustStore []byte)
- func CreateKeyAndTruststore(serverName string, authenticate bool) (keystore []byte, truststore []byte, clientTLSConf *tls.Config)
- func CreateKeystore(serverName string) (keystore []byte, clientTLSConf *tls.Config)
- func CreateKeystoreAndClientCerts(serverName string) (keystore []byte, caPem []byte, clientPem []byte, clientTLSConf *tls.Config)
- func CreateServerCertificates(serverName string) (publicKey, privateKey []byte, clientTLSConf *tls.Config)
- func DefaultSpec(t *testing.T, testKube *TestKubernetes, initializer func(*ispnv1.Infinispan)) *ispnv1.Infinispan
- func EncryptionSecret(name, namespace string, privKey, cert []byte) *corev1.Secret
- func EncryptionSecretClientCert(name, namespace string, caCert, clientCert []byte) *corev1.Secret
- func EncryptionSecretClientTrustore(name, namespace string, truststore []byte) *corev1.Secret
- func EncryptionSecretKeystore(name, namespace string, keystore []byte) *corev1.Secret
- func EndpointEncryption(name string) *ispnv1.EndpointEncryption
- func EndpointEncryptionClientCert(name string, clientCert ispnv1.ClientCertType) *ispnv1.EndpointEncryption
- func ExpectMaybeNotFound(err error)
- func ExpectNoError(err error)
- func ExpectNotFound(err error)
- func ExposeServiceSpec(testKube *TestKubernetes) *ispnv1.ExposeSpec
- func GetServerName(i *ispnv1.Infinispan) string
- func GetYamlReaderFromFile(filename string) (*yaml.YAMLReader, error)
- func LogError(err error)
- func NewKubernetesFromLocalConfig(scheme *runtime.Scheme, mapperProvider MapperProvider, ctx string) (*kube.Kubernetes, error)
- func Operand(ref string, manager *version.Manager) version.Operand
- func RunOperator(m *testing.M, k *TestKubernetes)
- func SkipForAWS(t *testing.T, message string)
- func SkipForMajor(t *testing.T, infinispanMajor uint64, message string)
- func SkipForOpenShift(t *testing.T, message string)
- func SkipPriorTo(t *testing.T, version, message string)
- func TestName(t *testing.T) string
- func ThrowHTTPError(rsp *http.Response)
- func WebServerDeployment(name, namespace, configName, mountPath, imageName string) *appsv1.Deployment
- func WebServerService(name, namespace string) *corev1.Service
- type CacheHelper
- func (c *CacheHelper) AssertCacheExists()
- func (c *CacheHelper) AssertSize(expectedEntries int)
- func (c *CacheHelper) Available(available bool)
- func (c *CacheHelper) Create(payload string, contentType mime.MimeType)
- func (c *CacheHelper) CreateWithDefault(flags ...string)
- func (c *CacheHelper) Delete()
- func (c *CacheHelper) Exists() bool
- func (c *CacheHelper) Get(key string) (string, bool)
- func (c *CacheHelper) Populate(numEntries int)
- func (c *CacheHelper) Put(key, value string, contentType mime.MimeType)
- func (c *CacheHelper) PutWithRetry(key, value string, contentType mime.MimeType, retries int)
- func (c *CacheHelper) Size() int
- func (c *CacheHelper) TestBasicUsage(key, value string)
- func (c *CacheHelper) TestBasicUsageWithRetry(key, value string, retries int)
- func (c *CacheHelper) Update(payload string, contentType mime.MimeType)
- func (c *CacheHelper) WaitForCacheToExist()
- func (c *CacheHelper) WaitForCacheToNotExist()
- type HTTPClient
- func HTTPClientForCluster(i *ispnv1.Infinispan, kube *TestKubernetes) HTTPClient
- func HTTPClientForClusterWithVersionManager(i *ispnv1.Infinispan, kube *TestKubernetes, manager *version.Manager) HTTPClient
- func HTTPSClientForCluster(i *ispnv1.Infinispan, tlsConfig *tls.Config, kube *TestKubernetes) HTTPClient
- func NewClient(auth authType, username, password *string, protocol string, ...) HTTPClient
- func NewHTTPClient(username, password, protocol string) HTTPClient
- func NewHTTPClientNoAuth(protocol string) HTTPClient
- type KeyCertPair
- type MapperProvider
- type OLMEnv
- type TestKubernetes
- func (k TestKubernetes) ApproveInstallPlan(sub *coreos.Subscription)
- func (k *TestKubernetes) AssertK8ResourceExists(name, namespace string, obj client.Object) bool
- func (k TestKubernetes) CleanNamespaceAndLogOnPanic(t *testing.T, namespace string)
- func (k TestKubernetes) CleanNamespaceAndLogWithPanic(t *testing.T, namespace string, panicVal interface{})
- func (k TestKubernetes) CleanupOLMTest(t *testing.T, testIdentifier, subName, subNamespace, subPackage string)
- func (k TestKubernetes) Create(obj client.Object)
- func (k TestKubernetes) CreateConfigMap(configMap *corev1.ConfigMap)
- func (k TestKubernetes) CreateInfinispan(infinispan *ispnv1.Infinispan, namespace string)
- func (k TestKubernetes) CreateOperatorGroup(name, namespace string, targetNamespaces ...string)
- func (k TestKubernetes) CreateOrUpdateAndWaitForCRD(crd *apiextv1.CustomResourceDefinition)
- func (k TestKubernetes) CreateSecret(secret *corev1.Secret)
- func (k TestKubernetes) CreateSubscription(sub *coreos.Subscription)
- func (k TestKubernetes) CreateSubscriptionAndApproveInitialVersion(olm OLMEnv, sub *coreos.Subscription)
- func (k TestKubernetes) DeleteBackup(backup *ispnv2.Backup)
- func (k TestKubernetes) DeleteBatch(batch *ispnv2.Batch)
- func (k TestKubernetes) DeleteCRD(name string)
- func (k TestKubernetes) DeleteCSV(name, namespace string)
- func (k TestKubernetes) DeleteCache(cache *ispnv2.Cache)
- func (k TestKubernetes) DeleteConfigMap(configMap *corev1.ConfigMap)
- func (k TestKubernetes) DeleteInfinispan(infinispan *ispnv1.Infinispan)
- func (k TestKubernetes) DeleteNamespace(namespace string)
- func (k TestKubernetes) DeleteOperatorGroup(name, namespace string)
- func (k TestKubernetes) DeleteResource(namespace string, selector labels.Selector, obj client.Object, ...)
- func (k TestKubernetes) DeleteRestore(restore *ispnv2.Restore)
- func (k TestKubernetes) DeleteSecret(secret *corev1.Secret)
- func (k TestKubernetes) DeleteSubscription(name, namespace string)
- func (k TestKubernetes) FindCacheResource(cacheName, clusterName, namespace string) *ispnv2.Cache
- func (k TestKubernetes) GetAdminServicePorts(namespace, name string) []corev1.ServicePort
- func (k TestKubernetes) GetBackup(name, namespace string) *ispnv2.Backup
- func (k TestKubernetes) GetBatch(name, namespace string) *ispnv2.Batch
- func (k TestKubernetes) GetCache(name, namespace string) *ispnv2.Cache
- func (k TestKubernetes) GetConfigMap(name, namespace string) *corev1.ConfigMap
- func (k TestKubernetes) GetDefaultStorageClass() string
- func (k TestKubernetes) GetPVC(pvcName, namespace string) *corev1.PersistentVolumeClaim
- func (k TestKubernetes) GetPVCList(namespace string, labels map[string]string) *corev1.PersistentVolumeClaimList
- func (k TestKubernetes) GetRestore(name, namespace string) *ispnv2.Restore
- func (k TestKubernetes) GetSchemaForRest(ispn *ispnv1.Infinispan) string
- func (k TestKubernetes) GetSecret(name, namespace string) *corev1.Secret
- func (k TestKubernetes) GetServicePorts(namespace, name string) []corev1.ServicePort
- func (k TestKubernetes) GetStatefulSet(name, namespace string) *appsv1.StatefulSet
- func (k TestKubernetes) GetUsedNodePorts() map[int32]struct{}
- func (k TestKubernetes) GracefulRestartInfinispan(infinispan *ispnv1.Infinispan, replicas int32, timeout time.Duration)
- func (k TestKubernetes) GracefulShutdownInfinispan(infinispan *ispnv1.Infinispan)
- func (k TestKubernetes) InstallPlan(sub *coreos.Subscription) *coreos.InstallPlan
- func (k TestKubernetes) InstalledCSV(sub *coreos.Subscription) (*coreos.ClusterServiceVersion, error)
- func (k TestKubernetes) InstalledCSVEnv(envName string, sub *coreos.Subscription) string
- func (k TestKubernetes) LoadResourceFromYaml(path string, obj runtime.Object)
- func (k TestKubernetes) NamespaceExists(namespace string) bool
- func (k TestKubernetes) NewNamespace(namespace string)
- func (k TestKubernetes) Nodes() []string
- func (k TestKubernetes) OLMNamespace() string
- func (k TestKubernetes) OLMTestEnv() OLMEnv
- func (k TestKubernetes) PackageManifest(packageName, catalogName string) (manifest *manifests.PackageManifest)
- func (k TestKubernetes) PortForward(pod, namespace string, ports []string) (chan struct{}, error)
- func (k TestKubernetes) RunOperator(namespace, crdsPath string) context.CancelFunc
- func (k TestKubernetes) SetRelatedImagesEnvs(sub *coreos.Subscription)
- func (k TestKubernetes) Subscription(sub *coreos.Subscription)
- func (k TestKubernetes) Update(obj client.Object)
- func (k TestKubernetes) UpdateConfigMap(configMap *corev1.ConfigMap)
- func (k TestKubernetes) UpdateInfinispan(ispn *ispnv1.Infinispan, update func()) error
- func (k TestKubernetes) UpdateSecret(secret *corev1.Secret)
- func (k TestKubernetes) UpdateSubscriptionChannel(newChannel string, sub *coreos.Subscription)
- func (k TestKubernetes) VersionManagerFromCSV(sub *coreos.Subscription) *version.Manager
- func (k TestKubernetes) WaitForCSVSucceeded(sub *coreos.Subscription)
- func (k TestKubernetes) WaitForCacheCondition(cacheName, clusterName, namespace string, condition ispnv2.CacheCondition) *ispnv2.Cache
- func (k TestKubernetes) WaitForCacheConditionReady(cacheName, clusterName, namespace string) *ispnv2.Cache
- func (k TestKubernetes) WaitForCacheState(cacheName, clusterName, namespace string, predicate func(*ispnv2.Cache) bool) *ispnv2.Cache
- func (k TestKubernetes) WaitForCrd(crd *apiextv1.CustomResourceDefinition)
- func (k *TestKubernetes) WaitForDeployment(name, namespace string) *appsv1.Deployment
- func (k *TestKubernetes) WaitForDeploymentState(name, namespace string, predicate func(deployment *appsv1.Deployment) bool) *appsv1.Deployment
- func (k TestKubernetes) WaitForExternalService(ispn *ispnv1.Infinispan, timeout time.Duration, client HTTPClient, ...) HTTPClient
- func (k TestKubernetes) WaitForInfinispanCondition(name, namespace string, condition ispnv1.ConditionType) *ispnv1.Infinispan
- func (k TestKubernetes) WaitForInfinispanConditionFalse(name, namespace string, condition ispnv1.ConditionType) *ispnv1.Infinispan
- func (k TestKubernetes) WaitForInfinispanConditionWithTimeout(name, namespace string, condition ispnv1.ConditionType, timeout time.Duration) *ispnv1.Infinispan
- func (k TestKubernetes) WaitForInfinispanPods(required int, timeout time.Duration, cluster, namespace string) *corev1.PodList
- func (k TestKubernetes) WaitForInfinispanPodsCreatedBy(required int, timeout time.Duration, createdByLabel string, namespace string) *corev1.PodList
- func (k TestKubernetes) WaitForInfinispanState(name, namespace string, predicate func(infinispan *ispnv1.Infinispan) bool) *ispnv1.Infinispan
- func (k TestKubernetes) WaitForInfinispanStateWithTimeout(name, namespace string, timeout time.Duration, ...) *ispnv1.Infinispan
- func (k TestKubernetes) WaitForPods(required int, timeout time.Duration, listOps *client.ListOptions, ...) *corev1.PodList
- func (k TestKubernetes) WaitForResourceRemoval(name, namespace string, obj client.Object)
- func (k TestKubernetes) WaitForStateFulSet(name string, namespace string)
- func (k TestKubernetes) WaitForStateFulSetRemoval(name string, namespace string)
- func (k TestKubernetes) WaitForSubscription(sub *coreos.Subscription, predicate func() (done bool))
- func (k TestKubernetes) WaitForSubscriptionState(state coreos.SubscriptionState, sub *coreos.Subscription)
- func (k TestKubernetes) WaitForValidBackupPhase(name, namespace string, phase ispnv2.BackupPhase)
- func (k TestKubernetes) WaitForValidRestorePhase(name, namespace string, phase ispnv2.RestorePhase) error
- func (k *TestKubernetes) WriteAllMetricsToFile(dir, namespace string)
- func (k TestKubernetes) WriteAllResourcesToFile(dir, namespace, suffix string, list runtime.Object, set labels.Set)
- func (k *TestKubernetes) WriteInfinispanMetricsToFile(i *v1.Infinispan, dir string)
Constants ¶
const ( KeystorePassword = "SuperSecret22" TruststorePassword = "SuperSecret22" )
const DEBUG = false
Variables ¶
var ( TestTimeout = timeout("TEST_TIMEOUT", "5m") SinglePodTimeout = timeout("TEST_SINGLE_POD_TIMEOUT", "5m") RouteTimeout = timeout("TEST_ROUTE_TIMEOUT", "4m") DefaultPollPeriod = timeout("TEST_DEFAULT_POLL_PERIOD", "1s") // DefaultPollPeriod is the default retry time when waiting for resources ConditionPollPeriod = timeout("TEST_CONDITION_POLL_PERIOD", "1s") MaxWaitTimeout = timeout("TEST_MAX_WAIT_TIMEOUT", "3m") // MaxWaitTimeout is the maximum time to wait for resources ConditionWaitTimeout = timeout("TEST_CONDITION_WAIT_TIMEOUT", "3m") LogOutputDir = constants.GetEnvWithDefault("TESTING_LOG_DIR", os.TempDir()+"/infinispan-operator") CPU = os.Getenv("INFINISPAN_CPU") Memory = constants.GetEnvWithDefault("INFINISPAN_MEMORY", "1Gi") Namespace = strings.ToLower(constants.GetEnvWithDefault("TESTING_NAMESPACE", "namespace-for-testing")) MultiNamespace = strings.ToLower(constants.GetEnvWithDefault("TESTING_MULTINAMESPACE", "namespace-for-testing-1,namespace-for-testing-2")) OperandVersion = os.Getenv("TESTING_OPERAND_VERSION") OperatorNamespace = strings.ToLower(constants.GetEnvWithDefault("TESTING_OPERATOR_NAMESPACE", "")) OperatorName = "infinispan-operator" OperatorSAName = strings.ToLower(constants.GetEnvWithDefault("OPERATOR_SA_NAME", "infinispan-operator-controller-manager")) RunLocalOperator = strings.ToUpper(constants.GetEnvWithDefault("RUN_LOCAL_OPERATOR", "true")) RunSaOperator = strings.ToUpper(constants.GetEnvWithDefault("RUN_SA_OPERATOR", "false")) CleanupInfinispan = strings.ToUpper(constants.GetEnvWithDefault("CLEANUP_INFINISPAN_ON_FINISH", "true")) SuiteMode, _ = strconv.ParseBool(constants.GetEnvWithDefault("SUITE_MODE", "false")) ExposeServiceType = constants.GetEnvWithDefault("EXPOSE_SERVICE_TYPE", string(ispnv1.ExposeTypeNodePort)) Infrastructure = os.Getenv("TESTING_INFRASTRUCTURE") Platform = os.Getenv("TESTING_PLATFORM") WebServerName = "external-libs-web-server" WebServerImageName = "quay.io/openshift-scale/nginx" WebServerRootFolder = "/usr/share/nginx/html" WebServerPortNumber = 8080 CleanupXSiteOnFinish = strings.ToUpper(constants.GetEnvWithDefault("TESTING_CLEANUP_XSITE_ON_FINISH", "TRUE")) == "TRUE" )
var DeleteOpts = []client.DeleteOption{ client.GracePeriodSeconds(int64(0)), client.PropagationPolicy(metav1.DeletePropagationBackground), }
DeleteOpts is used when deleting resources
var InfinispanTypeMeta = metav1.TypeMeta{
APIVersion: "infinispan.org/v1",
Kind: "Infinispan",
}
var LatestOperand = VersionManager().Latest()
var Scheme = runtime.NewScheme()
Scheme Runtime scheme
var VersionManager = func() *version.Manager { if os.Getenv(ispnv1.OperatorOperandVersionEnvVarName) == "" { _ = os.Setenv(ispnv1.OperatorOperandVersionEnvVarName, `[{ "downstream-version": "0.1.0", "upstream-version": "13.0.10", "image": "quay.io/infinispan/server:13.0.10.Final", "deprecated": true },{ "downstream-version": "0.2.0-1", "upstream-version": "14.0.1", "image": "quay.io/infinispan/server:14.0.1.Final" },{ "downstream-version": "0.2.1-1", "upstream-version": "14.0.6", "image": "quay.io/infinispan/server:14.0.6.Final" },{ "downstream-version": "0.2.2-1", "upstream-version": "14.0.9", "image": "quay.io/infinispan/server:14.0.9.Final" },{ "downstream-version": "0.2.3-1", "upstream-version": "14.0.13", "image": "quay.io/infinispan/server:14.0.13.Final" },{ "downstream-version": "0.2.4-1", "upstream-version": "14.0.17", "image": "quay.io/infinispan/server:14.0.17.Final" },{ "downstream-version": "0.2.5-1", "upstream-version": "14.0.19", "image": "quay.io/infinispan/server:14.0.19.Final" },{ "downstream-version": "0.2.6-1", "upstream-version": "14.0.20", "image": "quay.io/infinispan/server:14.0.20.Final" },{ "downstream-version": "0.2.7-1", "upstream-version": "14.0.21", "image": "quay.io/infinispan/server:14.0.21.Final" },{ "downstream-version": "0.2.8-1", "upstream-version": "14.0.24", "image": "quay.io/infinispan/server:14.0.24.Final" },{ "downstream-version": "0.2.9-1", "upstream-version": "14.0.27", "image": "quay.io/infinispan/server:14.0.27.Final" },{ "downstream-version": "0.3.0-1", "upstream-version": "15.0.0", "image": "quay.io/infinispan/server:15.0.0.Final" },{ "downstream-version": "0.3.1-1", "upstream-version": "15.0.3", "image": "quay.io/infinispan/server:15.0.3.Final" },{ "downstream-version": "0.3.2-1", "upstream-version": "15.0.4", "image": "quay.io/infinispan/server:15.0.4.Final" },{ "downstream-version": "0.3.2-2", "upstream-version": "15.0.4", "image": "quay.io/infinispan/server:15.0", "cve": true }]`) } if manager, err := version.ManagerFromEnv(ispnv1.OperatorOperandVersionEnvVarName); err != nil { panic(err) } else { return manager } }
Functions ¶
func CheckExternalAddress ¶
func CheckExternalAddress(client HTTPClient, operand version.Operand) bool
func CreateCrossSiteSingleKeyStoreAndTrustStore ¶
func CreateCrossSiteSingleKeyStoreAndTrustStore() (KeyStore, trustStore []byte)
func CreateDefaultCrossSiteKeyAndTrustStore ¶
func CreateDefaultCrossSiteKeyAndTrustStore() (transportKeyStore, routerKeyStore, trustStore []byte)
func CreateKeyAndTruststore ¶
func CreateKeyAndTruststore(serverName string, authenticate bool) (keystore []byte, truststore []byte, clientTLSConf *tls.Config)
CreateKeyAndTruststore returns a keystore & truststore using a self-signed certificate, and the corresponding tls.Config required by clients to connect to the server If authenticate is true, then the returned truststore contains all client certificates, otherwise it simply contains the CA for validation
func CreateKeystore ¶
CreateKeystore returns a keystore using a self-signed certificate, and the corresponding tls.Config required by clients to connect to the server
func CreateServerCertificates ¶
func CreateServerCertificates(serverName string) (publicKey, privateKey []byte, clientTLSConf *tls.Config)
CreateServerCertificates returns the public and private keys o
func DefaultSpec ¶
func DefaultSpec(t *testing.T, testKube *TestKubernetes, initializer func(*ispnv1.Infinispan)) *ispnv1.Infinispan
DefaultSpec creates a default Infinispan spec for tests. Consumers should utilise the initializer function to modify the spec before the resource is created. This allows for the webhook defaulting behaviour to be applied without deploying the webhooks
func EncryptionSecret ¶
func EndpointEncryption ¶
func EndpointEncryption(name string) *ispnv1.EndpointEncryption
func EndpointEncryptionClientCert ¶
func EndpointEncryptionClientCert(name string, clientCert ispnv1.ClientCertType) *ispnv1.EndpointEncryption
func ExpectMaybeNotFound ¶
func ExpectMaybeNotFound(err error)
ExpectMaybeNotFound ignores errors related to a resource not being found. Any other type of error halts execution.
func ExpectNoError ¶
func ExpectNoError(err error)
ExpectNoError checks if an error exists, and if so halts execution
func ExpectNotFound ¶
func ExpectNotFound(err error)
func ExposeServiceSpec ¶
func ExposeServiceSpec(testKube *TestKubernetes) *ispnv1.ExposeSpec
func GetServerName ¶
func GetServerName(i *ispnv1.Infinispan) string
func GetYamlReaderFromFile ¶
func GetYamlReaderFromFile(filename string) (*yaml.YAMLReader, error)
func NewKubernetesFromLocalConfig ¶
func NewKubernetesFromLocalConfig(scheme *runtime.Scheme, mapperProvider MapperProvider, ctx string) (*kube.Kubernetes, error)
NewKubernetesFromLocalConfig creates a new Kubernetes instance from configuration. The configuration is resolved locally from known locations.
func Operand ¶
Operand replicates the semantics of InitialiseOperandVersion pipeline handler for determing Operand version when no version is explicitly provided
func RunOperator ¶
func RunOperator(m *testing.M, k *TestKubernetes)
func SkipForAWS ¶
func SkipForOpenShift ¶
func SkipPriorTo ¶
func ThrowHTTPError ¶
func WebServerDeployment ¶
func WebServerDeployment(name, namespace, configName, mountPath, imageName string) *appsv1.Deployment
func WebServerService ¶
Types ¶
type CacheHelper ¶
type CacheHelper struct { Client HTTPClient CacheName string CacheClient api.Cache }
func NewCacheHelper ¶
func NewCacheHelper(cacheName string, client HTTPClient) *CacheHelper
func (*CacheHelper) AssertCacheExists ¶
func (c *CacheHelper) AssertCacheExists()
func (*CacheHelper) AssertSize ¶
func (c *CacheHelper) AssertSize(expectedEntries int)
func (*CacheHelper) Available ¶
func (c *CacheHelper) Available(available bool)
func (*CacheHelper) Create ¶
func (c *CacheHelper) Create(payload string, contentType mime.MimeType)
func (*CacheHelper) CreateWithDefault ¶
func (c *CacheHelper) CreateWithDefault(flags ...string)
func (*CacheHelper) Delete ¶
func (c *CacheHelper) Delete()
func (*CacheHelper) Exists ¶
func (c *CacheHelper) Exists() bool
func (*CacheHelper) Populate ¶
func (c *CacheHelper) Populate(numEntries int)
func (*CacheHelper) PutWithRetry ¶
func (c *CacheHelper) PutWithRetry(key, value string, contentType mime.MimeType, retries int)
func (*CacheHelper) Size ¶
func (c *CacheHelper) Size() int
func (*CacheHelper) TestBasicUsage ¶
func (c *CacheHelper) TestBasicUsage(key, value string)
func (*CacheHelper) TestBasicUsageWithRetry ¶
func (c *CacheHelper) TestBasicUsageWithRetry(key, value string, retries int)
func (*CacheHelper) Update ¶
func (c *CacheHelper) Update(payload string, contentType mime.MimeType)
func (*CacheHelper) WaitForCacheToExist ¶
func (c *CacheHelper) WaitForCacheToExist()
func (*CacheHelper) WaitForCacheToNotExist ¶
func (c *CacheHelper) WaitForCacheToNotExist()
type HTTPClient ¶
type HTTPClient interface { httpClient.HttpClient Quiet(quiet bool) SetHostAndPort(hostAndPort string) GetHostAndPort() string }
HTTPClient can perform HTTP operations
func HTTPClientForCluster ¶
func HTTPClientForCluster(i *ispnv1.Infinispan, kube *TestKubernetes) HTTPClient
func HTTPClientForClusterWithVersionManager ¶
func HTTPClientForClusterWithVersionManager(i *ispnv1.Infinispan, kube *TestKubernetes, manager *version.Manager) HTTPClient
func HTTPSClientForCluster ¶
func HTTPSClientForCluster(i *ispnv1.Infinispan, tlsConfig *tls.Config, kube *TestKubernetes) HTTPClient
func NewClient ¶
func NewClient(auth authType, username, password *string, protocol string, tlsConfig *tls.Config) HTTPClient
func NewHTTPClient ¶
func NewHTTPClient(username, password, protocol string) HTTPClient
NewHTTPClient return a new HTTPClient
func NewHTTPClientNoAuth ¶
func NewHTTPClientNoAuth(protocol string) HTTPClient
type KeyCertPair ¶
type MapperProvider ¶
type MapperProvider func(cfg *rest.Config, opts ...apiutil.DynamicRESTMapperOption) (meta.RESTMapper, error)
MapperProvider is a function that provides RESTMapper instances
type OLMEnv ¶
type OLMEnv struct { CatalogSource string CatalogSourceNamespace string SubName string SubNamespace string SubPackage string SubStartingCSV string PackageManifest *manifests.PackageManifest SourceChannel manifests.PackageChannel TargetChannel manifests.PackageChannel }
func (OLMEnv) PrintManifest ¶
func (env OLMEnv) PrintManifest()
type TestKubernetes ¶
type TestKubernetes struct {
Kubernetes *kube.Kubernetes
}
TestKubernetes abstracts testing related interaction with a Kubernetes cluster
func NewTestKubernetes ¶
func NewTestKubernetes(ctx string) *TestKubernetes
NewTestKubernetes creates a new instance of TestKubernetes
func (TestKubernetes) ApproveInstallPlan ¶
func (k TestKubernetes) ApproveInstallPlan(sub *coreos.Subscription)
func (*TestKubernetes) AssertK8ResourceExists ¶
func (k *TestKubernetes) AssertK8ResourceExists(name, namespace string, obj client.Object) bool
func (TestKubernetes) CleanNamespaceAndLogOnPanic ¶
func (k TestKubernetes) CleanNamespaceAndLogOnPanic(t *testing.T, namespace string)
func (TestKubernetes) CleanNamespaceAndLogWithPanic ¶
func (k TestKubernetes) CleanNamespaceAndLogWithPanic(t *testing.T, namespace string, panicVal interface{})
func (TestKubernetes) CleanupOLMTest ¶
func (k TestKubernetes) CleanupOLMTest(t *testing.T, testIdentifier, subName, subNamespace, subPackage string)
func (TestKubernetes) Create ¶
func (k TestKubernetes) Create(obj client.Object)
func (TestKubernetes) CreateConfigMap ¶
func (k TestKubernetes) CreateConfigMap(configMap *corev1.ConfigMap)
CreateConfigMap creates a ConfigMap
func (TestKubernetes) CreateInfinispan ¶
func (k TestKubernetes) CreateInfinispan(infinispan *ispnv1.Infinispan, namespace string)
CreateInfinispan creates an Infinispan resource in the given namespace
func (TestKubernetes) CreateOperatorGroup ¶
func (k TestKubernetes) CreateOperatorGroup(name, namespace string, targetNamespaces ...string)
func (TestKubernetes) CreateOrUpdateAndWaitForCRD ¶
func (k TestKubernetes) CreateOrUpdateAndWaitForCRD(crd *apiextv1.CustomResourceDefinition)
CreateOrUpdateAndWaitForCRD creates or updates a Custom Resource Definition (CRD), waiting it to become ready.
func (TestKubernetes) CreateSecret ¶
func (k TestKubernetes) CreateSecret(secret *corev1.Secret)
CreateSecret creates a secret
func (TestKubernetes) CreateSubscription ¶
func (k TestKubernetes) CreateSubscription(sub *coreos.Subscription)
func (TestKubernetes) CreateSubscriptionAndApproveInitialVersion ¶
func (k TestKubernetes) CreateSubscriptionAndApproveInitialVersion(olm OLMEnv, sub *coreos.Subscription)
func (TestKubernetes) DeleteBackup ¶
func (k TestKubernetes) DeleteBackup(backup *ispnv2.Backup)
func (TestKubernetes) DeleteBatch ¶
func (k TestKubernetes) DeleteBatch(batch *ispnv2.Batch)
func (TestKubernetes) DeleteCRD ¶
func (k TestKubernetes) DeleteCRD(name string)
DeleteCRD deletes a CustomResourceDefinition
func (TestKubernetes) DeleteCSV ¶
func (k TestKubernetes) DeleteCSV(name, namespace string)
func (TestKubernetes) DeleteCache ¶
func (k TestKubernetes) DeleteCache(cache *ispnv2.Cache)
func (TestKubernetes) DeleteConfigMap ¶
func (k TestKubernetes) DeleteConfigMap(configMap *corev1.ConfigMap)
DeleteConfigMap deletes a ConfigMap
func (TestKubernetes) DeleteInfinispan ¶
func (k TestKubernetes) DeleteInfinispan(infinispan *ispnv1.Infinispan)
func (TestKubernetes) DeleteNamespace ¶
func (k TestKubernetes) DeleteNamespace(namespace string)
DeleteNamespace deletes a namespace
func (TestKubernetes) DeleteOperatorGroup ¶
func (k TestKubernetes) DeleteOperatorGroup(name, namespace string)
func (TestKubernetes) DeleteResource ¶
func (k TestKubernetes) DeleteResource(namespace string, selector labels.Selector, obj client.Object, timeout time.Duration)
DeleteResource deletes the k8 resource and waits that all the pods and pvs associated with that resource are gone
func (TestKubernetes) DeleteRestore ¶
func (k TestKubernetes) DeleteRestore(restore *ispnv2.Restore)
func (TestKubernetes) DeleteSecret ¶
func (k TestKubernetes) DeleteSecret(secret *corev1.Secret)
DeleteSecret deletes a secret
func (TestKubernetes) DeleteSubscription ¶
func (k TestKubernetes) DeleteSubscription(name, namespace string)
func (TestKubernetes) FindCacheResource ¶
func (k TestKubernetes) FindCacheResource(cacheName, clusterName, namespace string) *ispnv2.Cache
func (TestKubernetes) GetAdminServicePorts ¶
func (k TestKubernetes) GetAdminServicePorts(namespace, name string) []corev1.ServicePort
func (TestKubernetes) GetBackup ¶
func (k TestKubernetes) GetBackup(name, namespace string) *ispnv2.Backup
func (TestKubernetes) GetBatch ¶
func (k TestKubernetes) GetBatch(name, namespace string) *ispnv2.Batch
func (TestKubernetes) GetCache ¶
func (k TestKubernetes) GetCache(name, namespace string) *ispnv2.Cache
func (TestKubernetes) GetConfigMap ¶
func (k TestKubernetes) GetConfigMap(name, namespace string) *corev1.ConfigMap
func (TestKubernetes) GetDefaultStorageClass ¶
func (k TestKubernetes) GetDefaultStorageClass() string
GetDefaultStorageClass returns the default StorageClasses name in cluster.
func (TestKubernetes) GetPVC ¶
func (k TestKubernetes) GetPVC(pvcName, namespace string) *corev1.PersistentVolumeClaim
GetPVC returns a PVC bound with given PVC name.
func (TestKubernetes) GetPVCList ¶
func (k TestKubernetes) GetPVCList(namespace string, labels map[string]string) *corev1.PersistentVolumeClaimList
func (TestKubernetes) GetRestore ¶
func (k TestKubernetes) GetRestore(name, namespace string) *ispnv2.Restore
func (TestKubernetes) GetSchemaForRest ¶
func (k TestKubernetes) GetSchemaForRest(ispn *ispnv1.Infinispan) string
func (TestKubernetes) GetSecret ¶
func (k TestKubernetes) GetSecret(name, namespace string) *corev1.Secret
GetSecret gets a secret
func (TestKubernetes) GetServicePorts ¶
func (k TestKubernetes) GetServicePorts(namespace, name string) []corev1.ServicePort
func (TestKubernetes) GetStatefulSet ¶
func (k TestKubernetes) GetStatefulSet(name, namespace string) *appsv1.StatefulSet
GetStatefulSet gets an Infinispan resource in the given namespace
func (TestKubernetes) GetUsedNodePorts ¶
func (k TestKubernetes) GetUsedNodePorts() map[int32]struct{}
GetUsedNodePorts returns a set of NodePorts currently in use by the cluster
func (TestKubernetes) GracefulRestartInfinispan ¶
func (k TestKubernetes) GracefulRestartInfinispan(infinispan *ispnv1.Infinispan, replicas int32, timeout time.Duration)
GracefulRestartInfinispan restarts the infinispan resource and waits that cluster is WellFormed
func (TestKubernetes) GracefulShutdownInfinispan ¶
func (k TestKubernetes) GracefulShutdownInfinispan(infinispan *ispnv1.Infinispan)
GracefulShutdownInfinispan deletes the infinispan resource and waits that all the pods are gone
func (TestKubernetes) InstallPlan ¶
func (k TestKubernetes) InstallPlan(sub *coreos.Subscription) *coreos.InstallPlan
func (TestKubernetes) InstalledCSV ¶
func (k TestKubernetes) InstalledCSV(sub *coreos.Subscription) (*coreos.ClusterServiceVersion, error)
func (TestKubernetes) InstalledCSVEnv ¶
func (k TestKubernetes) InstalledCSVEnv(envName string, sub *coreos.Subscription) string
func (TestKubernetes) LoadResourceFromYaml ¶
func (k TestKubernetes) LoadResourceFromYaml(path string, obj runtime.Object)
func (TestKubernetes) NamespaceExists ¶
func (k TestKubernetes) NamespaceExists(namespace string) bool
func (TestKubernetes) NewNamespace ¶
func (k TestKubernetes) NewNamespace(namespace string)
NewNamespace creates a new namespace
func (TestKubernetes) Nodes ¶
func (k TestKubernetes) Nodes() []string
Nodes returns a list of running nodes in the cluster
func (TestKubernetes) OLMNamespace ¶
func (k TestKubernetes) OLMNamespace() string
func (TestKubernetes) OLMTestEnv ¶
func (k TestKubernetes) OLMTestEnv() OLMEnv
func (TestKubernetes) PackageManifest ¶
func (k TestKubernetes) PackageManifest(packageName, catalogName string) (manifest *manifests.PackageManifest)
func (TestKubernetes) PortForward ¶
func (k TestKubernetes) PortForward(pod, namespace string, ports []string) (chan struct{}, error)
PortForward returns a stop channel that should be closed when port-forwarding is no longer required
func (TestKubernetes) RunOperator ¶
func (k TestKubernetes) RunOperator(namespace, crdsPath string) context.CancelFunc
RunOperator runs an operator on a Kubernetes cluster
func (TestKubernetes) SetRelatedImagesEnvs ¶
func (k TestKubernetes) SetRelatedImagesEnvs(sub *coreos.Subscription)
func (TestKubernetes) Subscription ¶
func (k TestKubernetes) Subscription(sub *coreos.Subscription)
func (TestKubernetes) Update ¶
func (k TestKubernetes) Update(obj client.Object)
func (TestKubernetes) UpdateConfigMap ¶
func (k TestKubernetes) UpdateConfigMap(configMap *corev1.ConfigMap)
UpdateConfigMap updates a ConfigMap
func (TestKubernetes) UpdateInfinispan ¶
func (k TestKubernetes) UpdateInfinispan(ispn *ispnv1.Infinispan, update func()) error
func (TestKubernetes) UpdateSecret ¶
func (k TestKubernetes) UpdateSecret(secret *corev1.Secret)
UpdateSecret updates a secret
func (TestKubernetes) UpdateSubscriptionChannel ¶
func (k TestKubernetes) UpdateSubscriptionChannel(newChannel string, sub *coreos.Subscription)
func (TestKubernetes) VersionManagerFromCSV ¶
func (k TestKubernetes) VersionManagerFromCSV(sub *coreos.Subscription) *version.Manager
func (TestKubernetes) WaitForCSVSucceeded ¶
func (k TestKubernetes) WaitForCSVSucceeded(sub *coreos.Subscription)
func (TestKubernetes) WaitForCacheCondition ¶
func (k TestKubernetes) WaitForCacheCondition(cacheName, clusterName, namespace string, condition ispnv2.CacheCondition) *ispnv2.Cache
WaitForCacheConditionReady retrieves the Cache CR that corresponds to the provided cache, cluster and namespace
func (TestKubernetes) WaitForCacheConditionReady ¶
func (k TestKubernetes) WaitForCacheConditionReady(cacheName, clusterName, namespace string) *ispnv2.Cache
WaitForCacheConditionReady retrieves the Cache CR that corresponds to the provided cache, cluster and namespace
func (TestKubernetes) WaitForCacheState ¶
func (k TestKubernetes) WaitForCacheState(cacheName, clusterName, namespace string, predicate func(*ispnv2.Cache) bool) *ispnv2.Cache
WaitForCacheState retrieves the Cache CR that corresponds to the provided cache, cluster and namespace, then waits for for the desired state
func (TestKubernetes) WaitForCrd ¶
func (k TestKubernetes) WaitForCrd(crd *apiextv1.CustomResourceDefinition)
func (*TestKubernetes) WaitForDeployment ¶
func (k *TestKubernetes) WaitForDeployment(name, namespace string) *appsv1.Deployment
func (*TestKubernetes) WaitForDeploymentState ¶
func (k *TestKubernetes) WaitForDeploymentState(name, namespace string, predicate func(deployment *appsv1.Deployment) bool) *appsv1.Deployment
func (TestKubernetes) WaitForExternalService ¶
func (k TestKubernetes) WaitForExternalService(ispn *ispnv1.Infinispan, timeout time.Duration, client HTTPClient, versionManager *version.Manager) HTTPClient
WaitForExternalService checks if an http server is listening at the endpoint exposed by the service (ns, name) The HostAndPort of the provided HTTPClient is updated to use the external service when available
func (TestKubernetes) WaitForInfinispanCondition ¶
func (k TestKubernetes) WaitForInfinispanCondition(name, namespace string, condition ispnv1.ConditionType) *ispnv1.Infinispan
func (TestKubernetes) WaitForInfinispanConditionFalse ¶
func (k TestKubernetes) WaitForInfinispanConditionFalse(name, namespace string, condition ispnv1.ConditionType) *ispnv1.Infinispan
func (TestKubernetes) WaitForInfinispanConditionWithTimeout ¶
func (k TestKubernetes) WaitForInfinispanConditionWithTimeout(name, namespace string, condition ispnv1.ConditionType, timeout time.Duration) *ispnv1.Infinispan
func (TestKubernetes) WaitForInfinispanPods ¶
func (TestKubernetes) WaitForInfinispanPodsCreatedBy ¶
func (TestKubernetes) WaitForInfinispanState ¶
func (k TestKubernetes) WaitForInfinispanState(name, namespace string, predicate func(infinispan *ispnv1.Infinispan) bool) *ispnv1.Infinispan
func (TestKubernetes) WaitForInfinispanStateWithTimeout ¶
func (k TestKubernetes) WaitForInfinispanStateWithTimeout(name, namespace string, timeout time.Duration, predicate func(infinispan *ispnv1.Infinispan) bool) *ispnv1.Infinispan
func (TestKubernetes) WaitForPods ¶
func (k TestKubernetes) WaitForPods(required int, timeout time.Duration, listOps *client.ListOptions, callback func([]corev1.Pod) bool) *corev1.PodList
WaitForPods waits for pods with given ListOptions to reach the desired count in ContainersReady state
func (TestKubernetes) WaitForResourceRemoval ¶
func (k TestKubernetes) WaitForResourceRemoval(name, namespace string, obj client.Object)
func (TestKubernetes) WaitForStateFulSet ¶
func (k TestKubernetes) WaitForStateFulSet(name string, namespace string)
func (TestKubernetes) WaitForStateFulSetRemoval ¶
func (k TestKubernetes) WaitForStateFulSetRemoval(name string, namespace string)
func (TestKubernetes) WaitForSubscription ¶
func (k TestKubernetes) WaitForSubscription(sub *coreos.Subscription, predicate func() (done bool))
func (TestKubernetes) WaitForSubscriptionState ¶
func (k TestKubernetes) WaitForSubscriptionState(state coreos.SubscriptionState, sub *coreos.Subscription)
func (TestKubernetes) WaitForValidBackupPhase ¶
func (k TestKubernetes) WaitForValidBackupPhase(name, namespace string, phase ispnv2.BackupPhase)
func (TestKubernetes) WaitForValidRestorePhase ¶
func (k TestKubernetes) WaitForValidRestorePhase(name, namespace string, phase ispnv2.RestorePhase) error
func (*TestKubernetes) WriteAllMetricsToFile ¶
func (k *TestKubernetes) WriteAllMetricsToFile(dir, namespace string)
func (TestKubernetes) WriteAllResourcesToFile ¶
func (*TestKubernetes) WriteInfinispanMetricsToFile ¶
func (k *TestKubernetes) WriteInfinispanMetricsToFile(i *v1.Infinispan, dir string)