MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / newFakePVC

Function newFakePVC

internal/controller/suite_test.go:398–438  ·  view source on GitHub ↗
(
	c client.Client,
	cluster *apiv1.Cluster,
	serial int,
	status persistentvolumeclaim.PVCStatus,
)

Source from the content-addressed store, hash-verified

396}
397
398func newFakePVC(
399 c client.Client,
400 cluster *apiv1.Cluster,
401 serial int,
402 status persistentvolumeclaim.PVCStatus,
403) []corev1.PersistentVolumeClaim {
404 var pvcGroup []corev1.PersistentVolumeClaim
405 pvc, err := persistentvolumeclaim.Build(
406 cluster,
407 &persistentvolumeclaim.CreateConfiguration{
408 Status: status,
409 NodeSerial: serial,
410 Calculator: persistentvolumeclaim.NewPgDataCalculator(),
411 Storage: cluster.Spec.StorageConfiguration,
412 })
413 Expect(err).ToNot(HaveOccurred())
414 cluster.SetInheritedDataAndOwnership(&pvc.ObjectMeta)
415
416 err = c.Create(context.Background(), pvc)
417 Expect(err).ToNot(HaveOccurred())
418 pvcGroup = append(pvcGroup, *pvc)
419
420 if cluster.ShouldCreateWalArchiveVolume() {
421 pvcWal, err := persistentvolumeclaim.Build(
422 cluster,
423 &persistentvolumeclaim.CreateConfiguration{
424 Status: status,
425 NodeSerial: serial,
426 Calculator: persistentvolumeclaim.NewPgWalCalculator(),
427 Storage: cluster.Spec.StorageConfiguration,
428 },
429 )
430 Expect(err).ToNot(HaveOccurred())
431 cluster.SetInheritedDataAndOwnership(&pvcWal.ObjectMeta)
432 err = c.Create(context.Background(), pvcWal)
433 Expect(err).ToNot(HaveOccurred())
434 pvcGroup = append(pvcGroup, *pvcWal)
435 }
436
437 return pvcGroup
438}
439
440// generateFakeCASecret follows the conventions established by cert.GenerateCASecret
441func generateFakeCASecret(c client.Client, name, namespace, domain string) (*corev1.Secret, *certs.KeyPair) {

Callers 2

generateClusterPVCFunction · 0.85

Calls 6

BuildFunction · 0.92
NewPgDataCalculatorFunction · 0.92
NewPgWalCalculatorFunction · 0.92
CreateMethod · 0.65

Tested by

no test coverage detected