Documentation ¶
Index ¶
- Constants
- Variables
- func CdToRoot(t *testing.T)
- func CreateSimpleInstance(k8sEnv K8sOperatorEnvironment, instanceName string, version string, ...)
- func CreateSimplePDB(k8sEnv K8sOperatorEnvironment, instanceName string)
- func CreateSimplePdbWithDbObj(k8sEnv K8sOperatorEnvironment, database *v1alpha1.Database)
- func CreateV1V2Images(k8sEnv K8sOperatorEnvironment) (map[string]string, map[string]string)
- func EnableGsmApi()
- func EnableIamApi()
- func EnableWiWithNodePool()
- func FindPodFor(ctx context.Context, clientSet *kubernetes.Clientset, ns, filter string) (*corev1.Pod, error)
- func GCloudServiceAccount() string
- func InsertData(pod, ns, pdb, user, table, value string)
- func InsertSimpleData(k8sEnv K8sOperatorEnvironment)
- func IsCanaryJob() bool
- func K8sCopyFromPodOrFail(pod, ns, container, src, dest string)
- func K8sCreateAndGet(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func K8sCreateWithRetry(k8sClient client.Client, ctx context.Context, obj client.Object)
- func K8sDeleteWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func K8sDeleteWithRetryNoWait(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func K8sExec(pod string, ns string, container string, cmd string) (string, error)
- func K8sExecuteSql(pod string, ns string, sql string) (string, error)
- func K8sExecuteSqlOrFail(pod, ns, sql string) string
- func K8sGetWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func K8sUpdateStatusWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func K8sUpdateWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func K8sVerifyUserConnectivity(pod, ns, pdb string, userCred map[string]string)
- func K8sWaitForUpdate(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, ...)
- func PrintClusterObjects()
- func PrintENV()
- func PrintEvents()
- func PrintLogs(CPNamespace string, DPNamespace string, env envtest.Environment, ...)
- func PrintPVCs()
- func PrintPods()
- func PrintSVCs()
- func PrintSimpleDebugInfo(k8sEnv K8sOperatorEnvironment, instanceName string, CDBName string)
- func RandName(base string) string
- func RunFunctionalTestSuite(t *testing.T, k8sClient *client.Client, k8sManager *ctrl.Manager, ...)
- func RunFunctionalTestSuiteWithWebhooks(t *testing.T, k8sClient *client.Client, k8sManager *ctrl.Manager, ...)
- func SetupServiceAccountBindingBetweenGcpAndK8s(k8sEnv K8sOperatorEnvironment)
- func StoreOracleLogs(pod string, ns string, instanceName string, CDBName string) error
- func TestImageForVersion(version string, edition string, extra string) string
- func UploadFileOrFail(localFile, bucket, object string)
- func VerifyData(pod, ns, pdb, user, table, value string)
- func VerifySimpleData(k8sEnv K8sOperatorEnvironment)
- func WaitForDatabaseConditionState(k8sEnv K8sOperatorEnvironment, key client.ObjectKey, condition string, ...)
- func WaitForInstanceConditionState(k8sEnv K8sOperatorEnvironment, key client.ObjectKey, condition string, ...)
- func WaitForObjectConditionState(k8sEnv K8sOperatorEnvironment, key client.ObjectKey, emptyObj client.Object, ...)
- type AdmissionWebhook
- type FakeDatabaseClient
- func (cli *FakeDatabaseClient) BootstrapDatabase(ctx context.Context, in *dbdpb.BootstrapDatabaseRequest, ...) (*dbdpb.BootstrapDatabaseResponse, error)
- func (cli *FakeDatabaseClient) BootstrapDatabaseAsync(ctx context.Context, in *dbdpb.BootstrapDatabaseAsyncRequest, ...) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) BootstrapDatabaseAsyncCalledCnt() int
- func (cli *FakeDatabaseClient) BootstrapStandby(ctx context.Context, in *dbdpb.BootstrapStandbyRequest, ...) (*dbdpb.BootstrapStandbyResponse, error)
- func (cli *FakeDatabaseClient) BounceDatabase(ctx context.Context, in *dbdpb.BounceDatabaseRequest, opts ...grpc.CallOption) (*dbdpb.BounceDatabaseResponse, error)
- func (cli *FakeDatabaseClient) BounceListener(ctx context.Context, in *dbdpb.BounceListenerRequest, opts ...grpc.CallOption) (*dbdpb.BounceListenerResponse, error)
- func (cli *FakeDatabaseClient) CheckDatabaseState(ctx context.Context, in *dbdpb.CheckDatabaseStateRequest, ...) (*dbdpb.CheckDatabaseStateResponse, error)
- func (cli *FakeDatabaseClient) CreateCDBAsync(ctx context.Context, in *dbdpb.CreateCDBAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) CreateDirs(ctx context.Context, in *dbdpb.CreateDirsRequest, opts ...grpc.CallOption) (*dbdpb.CreateDirsResponse, error)
- func (cli *FakeDatabaseClient) CreateFile(ctx context.Context, in *dbdpb.CreateFileRequest, opts ...grpc.CallOption) (*dbdpb.CreateFileResponse, error)
- func (cli *FakeDatabaseClient) CreateListener(ctx context.Context, in *dbdpb.CreateListenerRequest, opts ...grpc.CallOption) (*dbdpb.CreateListenerResponse, error)
- func (cli *FakeDatabaseClient) CreatePasswordFile(ctx context.Context, in *dbdpb.CreatePasswordFileRequest, ...) (*dbdpb.CreatePasswordFileResponse, error)
- func (cli *FakeDatabaseClient) DataPumpExportAsync(ctx context.Context, in *dbdpb.DataPumpExportAsyncRequest, ...) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) DataPumpExportAsyncCalledCnt() int
- func (cli *FakeDatabaseClient) DataPumpImportAsync(ctx context.Context, in *dbdpb.DataPumpImportAsyncRequest, ...) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) DataPumpImportAsyncCalledCnt() int
- func (cli *FakeDatabaseClient) DeleteDir(ctx context.Context, in *dbdpb.DeleteDirRequest, opts ...grpc.CallOption) (*dbdpb.DeleteDirResponse, error)
- func (cli *FakeDatabaseClient) DeleteOperation(ctx context.Context, in *lropb.DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
- func (cli *FakeDatabaseClient) DeleteOperationCalledCnt() int
- func (cli *FakeDatabaseClient) DownloadDirectoryFromGCS(ctx context.Context, in *dbdpb.DownloadDirectoryFromGCSRequest, ...) (*dbdpb.DownloadDirectoryFromGCSResponse, error)
- func (cli *FakeDatabaseClient) FetchServiceImageMetaData(ctx context.Context, in *dbdpb.FetchServiceImageMetaDataRequest, ...) (*dbdpb.FetchServiceImageMetaDataResponse, error)
- func (cli *FakeDatabaseClient) FileExists(ctx context.Context, in *dbdpb.FileExistsRequest, opts ...grpc.CallOption) (*dbdpb.FileExistsResponse, error)
- func (cli *FakeDatabaseClient) GetDatabaseName(ctx context.Context, in *dbdpb.GetDatabaseNameRequest, opts ...grpc.CallOption) (*dbdpb.GetDatabaseNameResponse, error)
- func (cli *FakeDatabaseClient) GetDatabaseType(ctx context.Context, in *dbdpb.GetDatabaseTypeRequest, opts ...grpc.CallOption) (*dbdpb.GetDatabaseTypeResponse, error)
- func (cli *FakeDatabaseClient) GetDownloadDirectoryFromGCSCnt() int
- func (cli *FakeDatabaseClient) GetOperation(context.Context, *lropb.GetOperationRequest, ...grpc.CallOption) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) GetOperationCalledCnt() int
- func (cli *FakeDatabaseClient) KnownPDBs(ctx context.Context, in *dbdpb.KnownPDBsRequest, opts ...grpc.CallOption) (*dbdpb.KnownPDBsResponse, error)
- func (cli *FakeDatabaseClient) ListOperations(ctx context.Context, in *lropb.ListOperationsRequest, opts ...grpc.CallOption) (*lropb.ListOperationsResponse, error)
- func (cli *FakeDatabaseClient) NID(ctx context.Context, in *dbdpb.NIDRequest, opts ...grpc.CallOption) (*dbdpb.NIDResponse, error)
- func (cli *FakeDatabaseClient) NextGetOperationStatus() FakeOperationStatus
- func (cli *FakeDatabaseClient) PhysicalRestoreAsync(ctx context.Context, in *dbdpb.PhysicalRestoreAsyncRequest, ...) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) PhysicalRestoreAsyncCalledCnt() int
- func (cli *FakeDatabaseClient) ReadDir(ctx context.Context, in *dbdpb.ReadDirRequest, opts ...grpc.CallOption) (*dbdpb.ReadDirResponse, error)
- func (cli *FakeDatabaseClient) RecoverConfigFile(ctx context.Context, in *dbdpb.RecoverConfigFileRequest, ...) (*dbdpb.RecoverConfigFileResponse, error)
- func (cli *FakeDatabaseClient) RemoveMethodToError(method string)
- func (cli *FakeDatabaseClient) Reset()
- func (cli *FakeDatabaseClient) RunDataGuard(ctx context.Context, req *dbdpb.RunDataGuardRequest, opts ...grpc.CallOption) (*dbdpb.RunDataGuardResponse, error)
- func (cli *FakeDatabaseClient) RunRMAN(ctx context.Context, in *dbdpb.RunRMANRequest, opts ...grpc.CallOption) (*dbdpb.RunRMANResponse, error)
- func (cli *FakeDatabaseClient) RunRMANAsync(ctx context.Context, in *dbdpb.RunRMANAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
- func (cli *FakeDatabaseClient) RunRMANAsyncCalledCnt() int
- func (cli *FakeDatabaseClient) RunRMANCalledCnt() int
- func (cli *FakeDatabaseClient) RunSQLPlus(ctx context.Context, in *dbdpb.RunSQLPlusCMDRequest, opts ...grpc.CallOption) (*dbdpb.RunCMDResponse, error)
- func (cli *FakeDatabaseClient) RunSQLPlusFormatted(ctx context.Context, in *dbdpb.RunSQLPlusCMDRequest, opts ...grpc.CallOption) (*dbdpb.RunCMDResponse, error)
- func (cli *FakeDatabaseClient) RunSQLPlusFormattedCalledCnt() int
- func (cli *FakeDatabaseClient) SetAsyncBootstrapDatabase(async bool)
- func (cli *FakeDatabaseClient) SetAsyncPhysicalBackup(async bool)
- func (cli *FakeDatabaseClient) SetAsyncPhysicalRestore(async bool)
- func (cli *FakeDatabaseClient) SetDnfsState(ctx context.Context, in *dbdpb.SetDnfsStateRequest, opts ...grpc.CallOption) (*dbdpb.SetDnfsStateResponse, error)
- func (cli *FakeDatabaseClient) SetListenerRegistration(ctx context.Context, in *dbdpb.SetListenerRegistrationRequest, ...) (*dbdpb.BounceListenerResponse, error)
- func (cli *FakeDatabaseClient) SetMethodToError(method string, err error)
- func (cli *FakeDatabaseClient) SetMethodToResp(method string, resp interface{})
- func (cli *FakeDatabaseClient) SetNextGetOperationStatus(status FakeOperationStatus)
- func (cli *FakeDatabaseClient) TNSPing(ctx context.Context, req *dbdpb.TNSPingRequest, opts ...grpc.CallOption) (*dbdpb.TNSPingResponse, error)
- type FakeDatabaseClientFactory
- type FakeOperationStatus
- type K8sOperatorEnvironment
- type Reconciler
- type Webhook
Constants ¶
const RetryInterval = time.Second * 1
const RetryTimeout = time.Second * 5
Variables ¶
var (
// Used by pitr test directly.
PitrAgentImage = "oracle.db.anthosapis.com/pitragent"
)
Functions ¶
func CreateSimpleInstance ¶
func CreateSimpleInstance(k8sEnv K8sOperatorEnvironment, instanceName string, version string, edition string)
CreateSimpleInstance creates a basic v1alpha1.Instance object named 'instanceName'. 'version' and 'edition' should match rules of TestImageForVersion(). Depends on the Ginkgo asserts.
func CreateSimplePDB ¶
func CreateSimplePDB(k8sEnv K8sOperatorEnvironment, instanceName string)
CreateSimplePDB creates a simple PDB 'pdb1' inside 'instanceName' Instance. Depends on the Ginkgo asserts.
func CreateSimplePdbWithDbObj ¶
func CreateSimplePdbWithDbObj(k8sEnv K8sOperatorEnvironment, database *v1alpha1.Database)
CreateSimplePdbWithDbObj creates simple PDB by given database object.
func CreateV1V2Images ¶
func CreateV1V2Images(k8sEnv K8sOperatorEnvironment) (map[string]string, map[string]string)
Create a new set of agent images from existing adding -v2 to the name Throw Ginkgo assert on failure.
func EnableWiWithNodePool ¶
func EnableWiWithNodePool()
EnableWiWithNodePool ensures workload identity enabled for PROW_CLUSTER.
func FindPodFor ¶
func GCloudServiceAccount ¶
func GCloudServiceAccount() string
GCloudServiceAccount returns the GCloud service account name.
func InsertData ¶
func InsertData(pod, ns, pdb, user, table, value string)
InsertData creates <table> in <pdb> and inserts <value>.
func InsertSimpleData ¶
func InsertSimpleData(k8sEnv K8sOperatorEnvironment)
InsertSimpleData creates 'test_table' in pdb1 and inserts a test row.
func IsCanaryJob ¶
func IsCanaryJob() bool
Returns true if 'PROW_CANARY_JOB' env is set. Canary Job is supposed to host all long-running tests.
func K8sCopyFromPodOrFail ¶
func K8sCopyFromPodOrFail(pod, ns, container, src, dest string)
K8sCopyFromPodOrFail copies file/dir in src path of the pod to local dest path. Depends on kubectl kubectl cp <pod>:<src> dest -n <ns> -c <container>
func K8sCreateAndGet ¶
func K8sCreateAndGet(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, obj client.Object, createdObj client.Object)
K8sCreateAndGet calls k8s Create() with retry and then wait for the object to be created. Updates 'createdObj' with the created object.
func K8sCreateWithRetry ¶
K8sCreateWithRetry calls k8s Create() with retry as k8s might require this in some cases (e.g. conflicts).
func K8sDeleteWithRetry ¶
func K8sDeleteWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, obj client.Object)
K8sDeleteWithRetry calls k8s Delete() with retry as k8s might require this in some cases (e.g. conflicts). Waits until the object gets deleted. Important: namespace objects never get completely deleted in testenv, use K8sDeleteWithRetryNoWait for deleting them https://github.com/kubernetes-sigs/controller-runtime/issues/880
func K8sDeleteWithRetryNoWait ¶
func K8sDeleteWithRetryNoWait(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, obj client.Object)
K8sDeleteWithRetryNoWait calls k8s Delete() with retry as k8s might require this in some cases (e.g. conflicts).
func K8sExec ¶
K8sExec execs a command in a pod and returns a string result. Depends on the Ginkgo asserts. kubectl exec <pod> <cmd> -n <ns> -c <container>
func K8sExecuteSql ¶
K8sExecuteSql executes multiple sql statements in an Oracle pod e.g. sql := `alter session set container=pdb1; create table test_table (name varchar(100)); insert into test_table values ('Hello World'); commit;` out, err = testhelpers.K8sExecuteSql("mydb-sts-0", "db", sql) Depends on the Ginkgo asserts. Please escape any bash special characters.
func K8sExecuteSqlOrFail ¶
K8sExecuteSqlOrFail is the same as K8sExecuteSql but raises a ginkgo assert on failure.
func K8sGetWithRetry ¶
func K8sGetWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, obj client.Object)
K8sGetWithRetry calls k8s Get() with retry as k8s might require this in some cases (e.g. conflicts).
func K8sUpdateStatusWithRetry ¶
func K8sUpdateStatusWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, emptyObj client.Object, modifyObjectFunc func(*client.Object))
K8sUpdateStatus makes the Get-Modify-UpdateStatus-Retry cycle easier Get a fresh version of the object into 'emptyObj' using 'objKey' Apply user-supplied modifyObjectFunc() which should modify the 'emptyObj' Try to update 'emptyObj' status in k8s, retry if needed Wait until the object gets updated.
func K8sUpdateWithRetry ¶
func K8sUpdateWithRetry(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, emptyObj client.Object, modifyObjectFunc func(*client.Object))
K8sUpdate makes the Get-Modify-Update-Retry cycle easier. Get a fresh version of the object into 'emptyObj' using 'objKey'. Apply user-supplied modifyObjectFunc() which should modify the 'emptyObj'. Try to update 'emptyObj' in k8s, retry if needed. Wait until the object gets updated.
func K8sVerifyUserConnectivity ¶
K8sVerifyUserConnectivity verified user connectivity on "oracledb" container. Or raise ginkgo assertion on failure. 5 retried in 30 second for each user is performed to workaround potential password sync latency between Config Server and Oracle DB.
func K8sWaitForUpdate ¶
func K8sWaitForUpdate(k8sClient client.Client, ctx context.Context, objKey client.ObjectKey, emptyObj client.Object, originalRV string)
K8sWaitForUpdate waits until GetResourceVersion changes compared to 'originalRV'. Updates 'emptyObj' with the new object.
func PrintClusterObjects ¶
func PrintClusterObjects()
Print cluster objects - events, pods, pvcs for all namespaces in the cluster
func PrintLogs ¶
func PrintLogs(CPNamespace string, DPNamespace string, env envtest.Environment, dumpLogsFor []string, instances []string)
Print logs from requested containers
func PrintSimpleDebugInfo ¶
func PrintSimpleDebugInfo(k8sEnv K8sOperatorEnvironment, instanceName string, CDBName string)
Prints logs for a typical single-instance test scenario in case of failure: Prints logs for 'manager', 'dbdaemon', 'oracledb' containers. Prints cluster objects. Stores Oracle trace logs to a local dir (or Prow Artifacts).
func RunFunctionalTestSuite ¶
func RunFunctionalTestSuite( t *testing.T, k8sClient *client.Client, k8sManager *ctrl.Manager, schemeBuilders []*runtime.SchemeBuilder, description string, controllers func() []Reconciler, crdPaths []string, )
RunFunctionalTestSuite runs all specs in the current package against a specialized testing environment. Before running the suite, this function configures the test environment by taking the following actions:
* Starting a control plane consisting of an etcd process and a Kubernetes API
server process.
* Installing CRDs into the control plane (using provided 'schemeBuilders') * Starting an in-process manager in a dedicated goroutine with the given
reconcilers installed in it.
These components will be torn down after the suite runs.
func RunFunctionalTestSuiteWithWebhooks ¶
func RunFunctionalTestSuiteWithWebhooks( t *testing.T, k8sClient *client.Client, k8sManager *ctrl.Manager, schemeBuilders []*runtime.SchemeBuilder, description string, controllers func() []Reconciler, crdPaths []string, webhooks func() []Webhook, admissionWebhookHandlers func() map[string]AdmissionWebhook, webhookPaths []string, )
RunFunctionalTestSuiteWithWebhooks extends RunFunctionalTestSuite allowing to set up test webhooks
func SetupServiceAccountBindingBetweenGcpAndK8s ¶
func SetupServiceAccountBindingBetweenGcpAndK8s(k8sEnv K8sOperatorEnvironment)
SetupServiceAccountBindingBetweenGcpAndK8s creates IAM policy binding between k8s service account <projectId>.svc.id.goog[<NAMESPACE>/default] and google service account.
func StoreOracleLogs ¶
StoreOracleLogs saves Oracle's trace logs from oracledb pod. Stores to $ARTIFACTS in case of a Prow job or in a temporary directory if running locally.
func TestImageForVersion ¶
TestImageForVersion returns service image for integration tests. Image paths are predefined in the env variables TEST_IMAGE_ORACLE_*.
func UploadFileOrFail ¶
func UploadFileOrFail(localFile, bucket, object string)
UploadFileOrFail uploads an object to GCS, it raises a ginkgo assert on failure.
func VerifyData ¶
func VerifyData(pod, ns, pdb, user, table, value string)
VerifyData checks that <value> in <pdb> exists.
func VerifySimpleData ¶
func VerifySimpleData(k8sEnv K8sOperatorEnvironment)
VerifySimpleData checks that the test row in 'pdb1' exists.
func WaitForDatabaseConditionState ¶
func WaitForDatabaseConditionState(k8sEnv K8sOperatorEnvironment, key client.ObjectKey, condition string, targetStatus metav1.ConditionStatus, targetReason string, timeout time.Duration)
WaitForDatabaseConditionState waits until the Database condition object status = targetStatus and reason = targetReason. Depends on the Ginkgo asserts.
func WaitForInstanceConditionState ¶
func WaitForInstanceConditionState(k8sEnv K8sOperatorEnvironment, key client.ObjectKey, condition string, targetStatus metav1.ConditionStatus, targetReason string, timeout time.Duration)
WaitForInstanceConditionState waits until the Instance condition object status = targetStatus and reason = targetReason. Depends on the Ginkgo asserts.
func WaitForObjectConditionState ¶
func WaitForObjectConditionState(k8sEnv K8sOperatorEnvironment, key client.ObjectKey, emptyObj client.Object, condition string, targetStatus metav1.ConditionStatus, targetReason string, timeout time.Duration, findConditionOrFailed func(conditions []metav1.Condition, name string) (bool, *metav1.Condition))
WaitForObjectConditionState waits until the k8s object condition object status = targetStatus and reason = targetReason. Objects supported: v1alpha1. {Instance, Import, Export} Depends on the Ginkgo asserts.
Types ¶
type AdmissionWebhook ¶
type AdmissionWebhook interface {
ServeHTTP(http.ResponseWriter, *http.Request)
}
type FakeDatabaseClient ¶
type FakeDatabaseClient struct { GotRMANAsyncRequest *dbdpb.RunRMANAsyncRequest // contains filtered or unexported fields }
FakeDatabaseClient mocks DatabaseDaemon
func (*FakeDatabaseClient) BootstrapDatabase ¶
func (cli *FakeDatabaseClient) BootstrapDatabase(ctx context.Context, in *dbdpb.BootstrapDatabaseRequest, opts ...grpc.CallOption) (*dbdpb.BootstrapDatabaseResponse, error)
BootstrapDatabase bootstraps seeded database by executing init_oracle
func (*FakeDatabaseClient) BootstrapDatabaseAsync ¶
func (cli *FakeDatabaseClient) BootstrapDatabaseAsync(ctx context.Context, in *dbdpb.BootstrapDatabaseAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
BootstrapDatabaseAsync bootstraps seeded database asynchronously.
func (*FakeDatabaseClient) BootstrapDatabaseAsyncCalledCnt ¶
func (cli *FakeDatabaseClient) BootstrapDatabaseAsyncCalledCnt() int
BootstrapDatabaseAsyncCalledCnt returns call count.
func (*FakeDatabaseClient) BootstrapStandby ¶
func (cli *FakeDatabaseClient) BootstrapStandby(ctx context.Context, in *dbdpb.BootstrapStandbyRequest, opts ...grpc.CallOption) (*dbdpb.BootstrapStandbyResponse, error)
BootstrapStandby performs bootstrap tasks that have to be done by dbdaemon.
func (*FakeDatabaseClient) BounceDatabase ¶
func (cli *FakeDatabaseClient) BounceDatabase(ctx context.Context, in *dbdpb.BounceDatabaseRequest, opts ...grpc.CallOption) (*dbdpb.BounceDatabaseResponse, error)
BounceDatabase RPC call to start/stop a database.
func (*FakeDatabaseClient) BounceListener ¶
func (cli *FakeDatabaseClient) BounceListener(ctx context.Context, in *dbdpb.BounceListenerRequest, opts ...grpc.CallOption) (*dbdpb.BounceListenerResponse, error)
BounceListener RPC call to start/stop a listener.
func (*FakeDatabaseClient) CheckDatabaseState ¶
func (cli *FakeDatabaseClient) CheckDatabaseState(ctx context.Context, in *dbdpb.CheckDatabaseStateRequest, opts ...grpc.CallOption) (*dbdpb.CheckDatabaseStateResponse, error)
CheckDatabaseState RPC call verifies the database is running.
func (*FakeDatabaseClient) CreateCDBAsync ¶
func (cli *FakeDatabaseClient) CreateCDBAsync(ctx context.Context, in *dbdpb.CreateCDBAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
CreateCDBAsync creates a database instance asynchronously.
func (*FakeDatabaseClient) CreateDirs ¶
func (cli *FakeDatabaseClient) CreateDirs(ctx context.Context, in *dbdpb.CreateDirsRequest, opts ...grpc.CallOption) (*dbdpb.CreateDirsResponse, error)
CreateDir RPC call to create a directory named path, along with any necessary parents.
func (*FakeDatabaseClient) CreateFile ¶
func (cli *FakeDatabaseClient) CreateFile(ctx context.Context, in *dbdpb.CreateFileRequest, opts ...grpc.CallOption) (*dbdpb.CreateFileResponse, error)
CreateFile creates file based on file path and content.
func (*FakeDatabaseClient) CreateListener ¶
func (cli *FakeDatabaseClient) CreateListener(ctx context.Context, in *dbdpb.CreateListenerRequest, opts ...grpc.CallOption) (*dbdpb.CreateListenerResponse, error)
CreateListener creates a database listener.
func (*FakeDatabaseClient) CreatePasswordFile ¶
func (cli *FakeDatabaseClient) CreatePasswordFile(ctx context.Context, in *dbdpb.CreatePasswordFileRequest, opts ...grpc.CallOption) (*dbdpb.CreatePasswordFileResponse, error)
CreatePasswordFile creates a password file for the database.
func (*FakeDatabaseClient) DataPumpExportAsync ¶
func (cli *FakeDatabaseClient) DataPumpExportAsync(ctx context.Context, in *dbdpb.DataPumpExportAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
DataPumpExportAsync exports data to a .dmp file using expdp
func (*FakeDatabaseClient) DataPumpExportAsyncCalledCnt ¶
func (cli *FakeDatabaseClient) DataPumpExportAsyncCalledCnt() int
DataPumpExportAsyncCalledCnt returns call count for DataPumpExportAsync.
func (*FakeDatabaseClient) DataPumpImportAsync ¶
func (cli *FakeDatabaseClient) DataPumpImportAsync(ctx context.Context, in *dbdpb.DataPumpImportAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
DataPumpImportAsync imports data from a .dmp file to an existing PDB.
func (*FakeDatabaseClient) DataPumpImportAsyncCalledCnt ¶
func (cli *FakeDatabaseClient) DataPumpImportAsyncCalledCnt() int
DataPumpImportAsyncCalledCnt returns call count for DataPumpImportAsync.
func (*FakeDatabaseClient) DeleteDir ¶
func (cli *FakeDatabaseClient) DeleteDir(ctx context.Context, in *dbdpb.DeleteDirRequest, opts ...grpc.CallOption) (*dbdpb.DeleteDirResponse, error)
DeleteDir RPC to call remove path.
func (*FakeDatabaseClient) DeleteOperation ¶
func (cli *FakeDatabaseClient) DeleteOperation(ctx context.Context, in *lropb.DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
DeleteOperation deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation.
func (*FakeDatabaseClient) DeleteOperationCalledCnt ¶
func (cli *FakeDatabaseClient) DeleteOperationCalledCnt() int
DeleteOperationCalledCnt returns call count.
func (*FakeDatabaseClient) DownloadDirectoryFromGCS ¶
func (cli *FakeDatabaseClient) DownloadDirectoryFromGCS(ctx context.Context, in *dbdpb.DownloadDirectoryFromGCSRequest, opts ...grpc.CallOption) (*dbdpb.DownloadDirectoryFromGCSResponse, error)
DownloadDirectoryFromGCS downloads a directory from GCS bucket to local path.
func (*FakeDatabaseClient) FetchServiceImageMetaData ¶
func (cli *FakeDatabaseClient) FetchServiceImageMetaData(ctx context.Context, in *dbdpb.FetchServiceImageMetaDataRequest, opts ...grpc.CallOption) (*dbdpb.FetchServiceImageMetaDataResponse, error)
FetchServiceImageMetaData returns the service image metadata.
func (*FakeDatabaseClient) FileExists ¶
func (cli *FakeDatabaseClient) FileExists(ctx context.Context, in *dbdpb.FileExistsRequest, opts ...grpc.CallOption) (*dbdpb.FileExistsResponse, error)
FileExists runs a simple check to confirm whether a requested file exists in a database container or not. An example of where FileExists is used is a check on the provisioning_successful file, but any file (nor a dir) can be checked via this RPC call.
func (*FakeDatabaseClient) GetDatabaseName ¶
func (cli *FakeDatabaseClient) GetDatabaseName(ctx context.Context, in *dbdpb.GetDatabaseNameRequest, opts ...grpc.CallOption) (*dbdpb.GetDatabaseNameResponse, error)
GetDatabaseName returns database name.
func (*FakeDatabaseClient) GetDatabaseType ¶
func (cli *FakeDatabaseClient) GetDatabaseType(ctx context.Context, in *dbdpb.GetDatabaseTypeRequest, opts ...grpc.CallOption) (*dbdpb.GetDatabaseTypeResponse, error)
GetDatabaseType returns database type(eg. ORACLE_12_2_ENTERPRISE_NONCDB)
func (*FakeDatabaseClient) GetDownloadDirectoryFromGCSCnt ¶
func (cli *FakeDatabaseClient) GetDownloadDirectoryFromGCSCnt() int
GetDownloadDirectoryFromGCSCnt returns call count.
func (*FakeDatabaseClient) GetOperation ¶
func (cli *FakeDatabaseClient) GetOperation(context.Context, *lropb.GetOperationRequest, ...grpc.CallOption) (*lropb.Operation, error)
GetOperation gets the latest state of a long-running operation. Clients can use this method to poll the operation result.
func (*FakeDatabaseClient) GetOperationCalledCnt ¶
func (cli *FakeDatabaseClient) GetOperationCalledCnt() int
GetOperationCalledCnt returns call count.
func (*FakeDatabaseClient) KnownPDBs ¶
func (cli *FakeDatabaseClient) KnownPDBs(ctx context.Context, in *dbdpb.KnownPDBsRequest, opts ...grpc.CallOption) (*dbdpb.KnownPDBsResponse, error)
KnownPDBs RPC call returns a list of known PDBs.
func (*FakeDatabaseClient) ListOperations ¶
func (cli *FakeDatabaseClient) ListOperations(ctx context.Context, in *lropb.ListOperationsRequest, opts ...grpc.CallOption) (*lropb.ListOperationsResponse, error)
ListOperations lists operations that match the specified filter in the request.
func (*FakeDatabaseClient) NID ¶
func (cli *FakeDatabaseClient) NID(ctx context.Context, in *dbdpb.NIDRequest, opts ...grpc.CallOption) (*dbdpb.NIDResponse, error)
NID changes a database id and/or database name.
func (*FakeDatabaseClient) NextGetOperationStatus ¶
func (cli *FakeDatabaseClient) NextGetOperationStatus() FakeOperationStatus
Return the next operation's status
func (*FakeDatabaseClient) PhysicalRestoreAsync ¶
func (cli *FakeDatabaseClient) PhysicalRestoreAsync(ctx context.Context, in *dbdpb.PhysicalRestoreAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
PhysicalRestoreAsync runs RMAN and SQL queries in sequence to restore a database from an RMAN backup.
func (*FakeDatabaseClient) PhysicalRestoreAsyncCalledCnt ¶
func (cli *FakeDatabaseClient) PhysicalRestoreAsyncCalledCnt() int
RMANAsyncCalledCnt returns call count.
func (*FakeDatabaseClient) ReadDir ¶
func (cli *FakeDatabaseClient) ReadDir(ctx context.Context, in *dbdpb.ReadDirRequest, opts ...grpc.CallOption) (*dbdpb.ReadDirResponse, error)
ReadDir RPC call to read the directory named by path and returns Fileinfos for the path and children.
func (*FakeDatabaseClient) RecoverConfigFile ¶
func (cli *FakeDatabaseClient) RecoverConfigFile(ctx context.Context, in *dbdpb.RecoverConfigFileRequest, opts ...grpc.CallOption) (*dbdpb.RecoverConfigFileResponse, error)
RecoverConfigFile creates a binary pfile from the backed up spfile
func (*FakeDatabaseClient) RemoveMethodToError ¶
func (cli *FakeDatabaseClient) RemoveMethodToError(method string)
func (*FakeDatabaseClient) Reset ¶
func (cli *FakeDatabaseClient) Reset()
Reset reset's the database client's counters.
func (*FakeDatabaseClient) RunDataGuard ¶
func (cli *FakeDatabaseClient) RunDataGuard(ctx context.Context, req *dbdpb.RunDataGuardRequest, opts ...grpc.CallOption) (*dbdpb.RunDataGuardResponse, error)
func (*FakeDatabaseClient) RunRMAN ¶
func (cli *FakeDatabaseClient) RunRMAN(ctx context.Context, in *dbdpb.RunRMANRequest, opts ...grpc.CallOption) (*dbdpb.RunRMANResponse, error)
RunRMAN RPC call executes Oracle's rman utility.
func (*FakeDatabaseClient) RunRMANAsync ¶
func (cli *FakeDatabaseClient) RunRMANAsync(ctx context.Context, in *dbdpb.RunRMANAsyncRequest, opts ...grpc.CallOption) (*lropb.Operation, error)
RunRMANAsync RPC call executes Oracle's rman utility asynchronously.
func (*FakeDatabaseClient) RunRMANAsyncCalledCnt ¶
func (cli *FakeDatabaseClient) RunRMANAsyncCalledCnt() int
RMANAsyncCalledCnt returns call count.
func (*FakeDatabaseClient) RunRMANCalledCnt ¶
func (cli *FakeDatabaseClient) RunRMANCalledCnt() int
RMANAsyncCalledCnt returns call count.
func (*FakeDatabaseClient) RunSQLPlus ¶
func (cli *FakeDatabaseClient) RunSQLPlus(ctx context.Context, in *dbdpb.RunSQLPlusCMDRequest, opts ...grpc.CallOption) (*dbdpb.RunCMDResponse, error)
RunSQLPlus RPC call executes Oracle's sqlplus utility.
func (*FakeDatabaseClient) RunSQLPlusFormatted ¶
func (cli *FakeDatabaseClient) RunSQLPlusFormatted(ctx context.Context, in *dbdpb.RunSQLPlusCMDRequest, opts ...grpc.CallOption) (*dbdpb.RunCMDResponse, error)
RunSQLPlusFormatted RPC is similar to RunSQLPlus, but for queries.
func (*FakeDatabaseClient) RunSQLPlusFormattedCalledCnt ¶
func (cli *FakeDatabaseClient) RunSQLPlusFormattedCalledCnt() int
RunSQLPlusFormattedCalledCnt return call count.
func (*FakeDatabaseClient) SetAsyncBootstrapDatabase ¶
func (cli *FakeDatabaseClient) SetAsyncBootstrapDatabase(async bool)
func (*FakeDatabaseClient) SetAsyncPhysicalBackup ¶
func (cli *FakeDatabaseClient) SetAsyncPhysicalBackup(async bool)
func (*FakeDatabaseClient) SetAsyncPhysicalRestore ¶
func (cli *FakeDatabaseClient) SetAsyncPhysicalRestore(async bool)
func (*FakeDatabaseClient) SetDnfsState ¶
func (cli *FakeDatabaseClient) SetDnfsState(ctx context.Context, in *dbdpb.SetDnfsStateRequest, opts ...grpc.CallOption) (*dbdpb.SetDnfsStateResponse, error)
func (*FakeDatabaseClient) SetListenerRegistration ¶
func (cli *FakeDatabaseClient) SetListenerRegistration(ctx context.Context, in *dbdpb.SetListenerRegistrationRequest, opts ...grpc.CallOption) (*dbdpb.BounceListenerResponse, error)
SetListenerRegistration sets a static listener registration and restarts the listener.
func (*FakeDatabaseClient) SetMethodToError ¶
func (cli *FakeDatabaseClient) SetMethodToError(method string, err error)
func (*FakeDatabaseClient) SetMethodToResp ¶
func (cli *FakeDatabaseClient) SetMethodToResp(method string, resp interface{})
func (*FakeDatabaseClient) SetNextGetOperationStatus ¶
func (cli *FakeDatabaseClient) SetNextGetOperationStatus(status FakeOperationStatus)
Set the next operation's status
func (*FakeDatabaseClient) TNSPing ¶
func (cli *FakeDatabaseClient) TNSPing(ctx context.Context, req *dbdpb.TNSPingRequest, opts ...grpc.CallOption) (*dbdpb.TNSPingResponse, error)
type FakeDatabaseClientFactory ¶
type FakeDatabaseClientFactory struct { Dbclient *FakeDatabaseClient // contains filtered or unexported fields }
FakeDatabaseClientFactory is a simple factory to create our FakeDatabaseClient.
func (*FakeDatabaseClientFactory) New ¶
func (g *FakeDatabaseClientFactory) New(context.Context, client.Reader, string, string) (dbdpb.DatabaseDaemonClient, func() error, error)
New returns a new fake DatabaseClient.
func (*FakeDatabaseClientFactory) Reset ¶
func (g *FakeDatabaseClientFactory) Reset()
type FakeOperationStatus ¶
type FakeOperationStatus int32
FakeOperationStatus is an enum type for LRO statuses.
const ( //StatusUndefined undefined. StatusUndefined FakeOperationStatus = iota //StatusRunning running. StatusRunning //StatusDone done. StatusDone //StatusDoneWithError done with error. StatusDoneWithError //StatusNotFound not found. StatusNotFound )
type K8sOperatorEnvironment ¶
type K8sOperatorEnvironment struct { Env envtest.Environment CPNamespace string DPNamespace string Ctx context.Context K8sClient client.Client OperCleanup func() error // Operator deployment cleanup callback. TestFailed bool // If true then dump container logs. K8sServiceAccount string }
K8sOperatorEnvironment is a helper for integration testing.
Encapsulates all necessary variables to work with the test cluster Can be created/destroyed multiple times within one test suite Depends on the Ginkgo asserts Example usage:
// Global variable, to be accessible by AfterSuite. var k8sEnv = testhelpers.K8sEnvironment{} // In case of Ctrl-C, clean up the last valid k8sEnv. AfterSuite(func() {
k8sEnv.Close()
}) ... BeforeEach(func() {
k8sEnv.Init(testhelpers.RandName("k8s-env-stress-test"))
}) AfterEach(func() {
k8sEnv.Close()
})
func (*K8sOperatorEnvironment) Close ¶
func (k8sEnv *K8sOperatorEnvironment) Close()
Close cleans cluster objects and uninstalls operator.
func (*K8sOperatorEnvironment) Init ¶
func (k8sEnv *K8sOperatorEnvironment) Init(CPNamespace string, DPNamespace string)
Init the environment, install CRDs, deploy operator, declare namespaces for control plane and data plane.
type Reconciler ¶
Reconciler is the interface to setup a reconciler for testing.