testlib

package
v2.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const ADMIN_HELM_CHART_PATH = "../../stable/admin"
View Source
const CA_CERT_FILE = "ca.cert"
View Source
const CA_CERT_FILE_NEW = "ca_new.cert"
View Source
const CA_CERT_SECRET = "nuodb-ca-cert"
View Source
const CERTIFICATES_BACKUP_PATH = "/tmp/keys_backup"
View Source
const CERTIFICATES_GENERATION_PATH = "/tmp/keys"
View Source
const DATABASE_HELM_CHART_PATH = "../../stable/database"
View Source
const DEBUG_POD = `` /* 475-byte string literal not displayed */
View Source
const IMPORT_ARCHIVE_URL = "https://download.nuohub.org/ce_releases/restore.bak.tz"
View Source
const INJECT_FILE = "../../versionInject.yaml"
View Source
const K8S_EVENT_LOG_FILE = "kubernetes_event.log"
View Source
const KEYSTORE_FILE = "nuoadmin.p12"
View Source
const KEYSTORE_SECRET = "nuodb-keystore"
View Source
const MINIMAL_VIABLE_ENGINE_CPU = "500m"

suffix "m" for spec.containers[].resources.requests.cpu denotes "millicores", and 1 CPU is equivalent to 1000m

View Source
const MINIMAL_VIABLE_ENGINE_MEMORY = "500Mi"
View Source
const NUOCMD_FILE = "nuocmd.pem"
View Source
const NUOCMD_SECRET = "nuodb-client-pem"
View Source
const RESTORE_HELM_CHART_PATH = "../../stable/restore"
View Source
const RESULT_DIR = "../../results"
View Source
const SECRET_PASSWORD = "changeIt"
View Source
const TEARDOWN_ADMIN = "admin"
View Source
const TEARDOWN_BACKUP = "backup"
View Source
const TEARDOWN_DATABASE = "database"
View Source
const TEARDOWN_RESTORE = "database"
View Source
const TEARDOWN_SECRETS = "secrets"
View Source
const TEARDOWN_YCSB = "ycsb"
View Source
const THP_HELM_CHART_PATH = "../../stable/transparent-hugepage"
View Source
const TLS_GENERATOR_POD_TEMPLATE = `` /* 170-byte string literal not displayed */
View Source
const TLS_SECRET_NO_PASSWORD_YAML_TEMPLATE = `---
apiVersion: v1
kind: Secret
metadata:
  name: %s
  namespace: %s
apiVersion: v1
data:
  %s: %s
`
View Source
const TLS_SECRET_PASSWORD_YAML_TEMPLATE = `---
apiVersion: v1
kind: Secret
metadata:
  name: %s
  namespace: %s
apiVersion: v1
data:
  %s: %s
  password: %s
`
View Source
const TRUSTSTORE_FILE = "nuoadmin-truststore.p12"
View Source
const TRUSTSTORE_SECRET = "nuodb-truststore"
View Source
const YCSB_HELM_CHART_PATH = "../../incubator/demo-ycsb"

Variables

View Source
var AdminRolesRequirePatching = false

Functions

func AddTeardown

func AddTeardown(name string, teardownFunc func())

*

  • add a teardown function to the named list - for later execution

func Await

func Await(t *testing.T, lmbd func() bool, timeout time.Duration)

func AwaitAdminFullyConnected

func AwaitAdminFullyConnected(t *testing.T, namespace string, podName string, numServers int)

func AwaitBalancerTerminated

func AwaitBalancerTerminated(t *testing.T, namespace string, expectedName string)

func AwaitDatabaseRestart

func AwaitDatabaseRestart(t *testing.T, namespace string, podName string, databaseName string, databaseOptions *helm.Options, restart func())

func AwaitDatabaseUp

func AwaitDatabaseUp(t *testing.T, namespace string, podName string, databaseName string, numProcesses int)

func AwaitNoPods

func AwaitNoPods(t *testing.T, namespace string, expectedName string)

func AwaitNrReplicasReady

func AwaitNrReplicasReady(t *testing.T, namespace string, expectedName string, nrReplicas int)

func AwaitNrReplicasScheduled

func AwaitNrReplicasScheduled(t *testing.T, namespace string, expectedName string, nrReplicas int)

func AwaitPodHasVersion

func AwaitPodHasVersion(t *testing.T, namespace string, podName string, expectedVersion string, timeout time.Duration)

func AwaitPodObjectRecreated

func AwaitPodObjectRecreated(t *testing.T, namespace string, pod *corev1.Pod, timeout time.Duration)

func AwaitPodPhase

func AwaitPodPhase(t *testing.T, namespace string, podName string, phase corev1.PodPhase, timeout time.Duration)

func AwaitPodRestartCountGreaterThan

func AwaitPodRestartCountGreaterThan(t *testing.T, namespace string, podName string, expectedRestartCount int32,
	timeout time.Duration)

func AwaitPodStatus

func AwaitPodStatus(t *testing.T, namespace string, podName string, condition corev1.PodConditionType,
	status corev1.ConditionStatus, timeout time.Duration)

func AwaitPodTemplateHasVersion

func AwaitPodTemplateHasVersion(t *testing.T, namespace string, podNameTemplate string, expectedVersion string, timeout time.Duration)

func AwaitPodUp

func AwaitPodUp(t *testing.T, namespace string, adminPodName string, timeout time.Duration)

func AwaitTillerUp

func AwaitTillerUp(t *testing.T)

func BackupCerificateFilesOnTestFailure

func BackupCerificateFilesOnTestFailure(t *testing.T, namespaceName string, srcDirectory string)

func CopyCertificatesToControlHost

func CopyCertificatesToControlHost(t *testing.T, podName string, namespaceName string) string

func CreateNamespace

func CreateNamespace(t *testing.T, namespaceName string)

func CreateSecret

func CreateSecret(t *testing.T, namespaceName string, certName string, secretName string, keyDir string)

func CreateSecretWithPassword

func CreateSecretWithPassword(t *testing.T, namespaceName string, certName string, secretName string, password string, keyDir string)

func DeleteDatabase

func DeleteDatabase(t *testing.T, namespace string, dbName string, podName string)

func DeletePod

func DeletePod(t *testing.T, namespace string, podName string)

func EnsureDatabaseNotRunning

func EnsureDatabaseNotRunning(t *testing.T, adminPod string, opt ExtractedOptions, kubectlOptions *k8s.KubectlOptions)

func ExecuteCommandsInPod

func ExecuteCommandsInPod(t *testing.T, namespaceName string, podName string, commands []string)

func GenerateCustomCertificates

func GenerateCustomCertificates(t *testing.T, podName string, namespaceName string, commands []string)

func GenerateTLSConfiguration

func GenerateTLSConfiguration(t *testing.T, namespaceName string, commands []string) (string, string)

func GetAdminEventLog

func GetAdminEventLog(t *testing.T, namespace string, podName string)

func GetAppLog

func GetAppLog(t *testing.T, namespace string, podName string, fileNameSuffix string, podLogOptions *corev1.PodLogOptions)

func GetDaemonSet

func GetDaemonSet(t *testing.T, namespace string, daemonSetName string) *v1.DaemonSet

func GetDiagnoseOnTestFailure

func GetDiagnoseOnTestFailure(t *testing.T, namespace string, podName string)

func GetK8sEventLog

func GetK8sEventLog(t *testing.T, namespace string)

func GetPod

func GetPod(t *testing.T, namespace string, podName string) *corev1.Pod

func GetPodName

func GetPodName(t *testing.T, namespaceName string, expectedName string) string

func GetPodRestartCount

func GetPodRestartCount(t *testing.T, namespace string, podName string) int32

func GetReplicationController

func GetReplicationController(t *testing.T, namespace string, replicationControllerName string) *corev1.ReplicationController

func GetSecret

func GetSecret(t *testing.T, namespace string, secretName string) *corev1.Secret

func GetService

func GetService(t *testing.T, namespaceName string, serviceName string) *corev1.Service

func GetStringOccurrenceInLog

func GetStringOccurrenceInLog(t *testing.T, namespace string, podName string, expectedLogLine string, podLogOptions *corev1.PodLogOptions) int

func GetUpgradedReleaseVersion

func GetUpgradedReleaseVersion(t *testing.T, options *helm.Options, suggestedVersion string) string

func InjectTestVersion

func InjectTestVersion(t *testing.T, options *helm.Options)

func IsDaemonSetHotCopyEnabled

func IsDaemonSetHotCopyEnabled(ss *appsv1.DaemonSet) bool

func IsOpenShiftEnvironment

func IsOpenShiftEnvironment(t *testing.T) bool

func IsStatefulSetHotCopyEnabled

func IsStatefulSetHotCopyEnabled(ss *appsv1.StatefulSet) bool

func KillAdminPod

func KillAdminPod(t *testing.T, namespace string, podName string)

func KillProcess

func KillProcess(t *testing.T, namespace string, podName string)

func LabelNodes

func LabelNodes(t *testing.T, namespaceName string, labelName string, labelValue string)

func PingService

func PingService(t *testing.T, namespace string, serviceName string, podName string)

func PrintCertificateFilesOnTestFailure

func PrintCertificateFilesOnTestFailure(t *testing.T, srcDirectory string)

func ReadAll

func ReadAll(path string) ([]byte, error)

func RecoverCoresFromTEs

func RecoverCoresFromTEs(t *testing.T, namespaceName string, databaseName string)

func RemoveEmptyLines

func RemoveEmptyLines(s string) string

func RotateTLSCertificates

func RotateTLSCertificates(t *testing.T, options *helm.Options, namespaceName string,
	adminReleaseName string, databaseReleaseName string, tlsKeysLocation string, helmUpgrade bool)

func RunSQL

func RunSQL(t *testing.T, namespace string, podName string, databaseName string, sql string) (result string, err error)

func StartAdmin

func StartAdmin(t *testing.T, options *helm.Options, replicaCount int, namespace string) (string, string)

func StartAdminFromHelmRepository

func StartAdminFromHelmRepository(t *testing.T, options *helm.Options, fromHelmVersion string, replicaCount int, namespace string) (string, string)

func StartAdminTemplate

func StartAdminTemplate(t *testing.T, options *helm.Options, replicaCount int, namespace string, installStep AdminInstallationStep) (helmChartReleaseName string, namespaceName string)

func StartDatabase

func StartDatabase(t *testing.T, namespace string, adminPod string, options *helm.Options) string

func StartDatabaseFromHelmRepository

func StartDatabaseFromHelmRepository(t *testing.T, namespace string, adminPod string, fromHelmVersion string, options *helm.Options) string

func StartDatabaseTemplate

func StartDatabaseTemplate(t *testing.T, namespaceName string, adminPod string, options *helm.Options, installationStep DatabaseInstallationStep) (helmChartReleaseName string)

func StartYCSBWorkload

func StartYCSBWorkload(t *testing.T, namespaceName string, options *helm.Options) (helmChartReleaseName string)

func Teardown

func Teardown(name string)

*

  • Call the stored teardown functions in the named list, in the correct order (last-in-first-out)

func UnmarshalJSONObject

func UnmarshalJSONObject(t *testing.T, stringJSON string) map[string]interface{}

func VerifyAdminKvSetAndGet

func VerifyAdminKvSetAndGet(t *testing.T, podName string, namespaceName string)

func VerifyAdminState

func VerifyAdminState(t *testing.T, namespace string, podName string)

func VerifyCertificateInLog

func VerifyCertificateInLog(t *testing.T, namespace string, podName string, expectedLogLine string)

func VerifyLicenseFile

func VerifyLicenseFile(t *testing.T, namespace string, podName string, expectedLicense string)

func VerifyLicenseIsCommunity

func VerifyLicenseIsCommunity(t *testing.T, namespace string, podName string)

func VerifyLicensingErrorsInLog

func VerifyLicensingErrorsInLog(t *testing.T, namespace string, podName string, expectError bool)

func VerifyPolicyInstalled

func VerifyPolicyInstalled(t *testing.T, namespace string, podName string)

func VerifyTeardown

func VerifyTeardown(t *testing.T)

* * Verify all teardownLists have been executed already; and throw an ASSERT if not. * Can be used to verify correct codng of a test that uses teardown. * * NOTE: while the funcs are called in the correct order for each list, there can be * NO guarantee that the lists are iterated in the correct order. * * This function MUST NOT be used as a replacement for calling teardown() at the correct point in the code.

Types

type AdminInstallationStep

type AdminInstallationStep func(t *testing.T, options *helm.Options, helmChartReleaseName string)

type DBVersion

type DBVersion struct {
	Major int `json:"major"`
	Minor int `json:"minor"`
}

func GetDatabaseIncarnation

func GetDatabaseIncarnation(t *testing.T, namespace string, podName string, databaseName string) *DBVersion

type DatabaseInstallationStep

type DatabaseInstallationStep func(t *testing.T, options *helm.Options, helmChartReleaseName string)

type ExtractedOptions

type ExtractedOptions struct {
	NrTePods          int
	NrSmHotCopyPods   int
	NrSmNoHotCopyPods int
	NrSmPods          int
	DbName            string
	ClusterName       string
}

func GetExtractedOptions

func GetExtractedOptions(options *helm.Options) (opt ExtractedOptions)

type NuoDBArchive

type NuoDBArchive struct {
	Id     int    `json:"id"`
	DbName string `json:"dbName"`
	Path   string `json:"path"`
	State  string `json:"state"`
}

func UnmarshalArchives

func UnmarshalArchives(s string) (err error, archives []NuoDBArchive)

type NuoDBDatabase

type NuoDBDatabase struct {
	Incarnation DBVersion `json:"incarnation"`
	Name        string    `json:"name"`
	Processes   string    `json:"processes"`
	State       string    `json:"state"`
}

func UnmarshalDatabase

func UnmarshalDatabase(s string) (err error, databases []NuoDBDatabase)

type NuoDBKubeConfig

type NuoDBKubeConfig struct {
	Pods         map[string]corev1.Pod     `json:"pods"`
	Deployments  map[string]v1.Deployment  `json:"deployments"`
	StatefulSets map[string]v1.StatefulSet `json:"statefulsets"`
	Volumes      map[string]corev1.Volume  `json:"volumes"`
	DaemonSets   map[string]v1.DaemonSet   `json:"daemonSets"`
}

func GetNuoDBK8sConfigDump

func GetNuoDBK8sConfigDump(t *testing.T, namespace string, podName string) NuoDBKubeConfig

func UnmarshalNuoDBKubeConfig

func UnmarshalNuoDBKubeConfig(s string) (err error, kubeConfigs []NuoDBKubeConfig)

type NuoDBProcess

type NuoDBProcess struct {
	Address  string            `json:"address"`
	DbName   string            `json:"dbName"`
	Type     string            `json:"type"`
	Host     string            `json:"host"`
	Hostname string            `json:"hostname"`
	Labels   map[string]string `json:"labels"`
}

func Unmarshal

func Unmarshal(s string) (err error, processes []NuoDBProcess)

type Registry

type Registry struct {
	Nuodb struct {
		Image struct {
			Registry   string
			Repository string
			Tag        string
		}
	}
}

func UnmarshalImageYAML

func UnmarshalImageYAML(s string) (err error, registry Registry)

UnmarshalImageYAML is used to unmarshal into map[string]string

Jump to

Keyboard shortcuts

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