MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / TestInstancePod

Function TestInstancePod

internal/postgres/reconcile_test.go:63–782  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestInstancePod(t *testing.T) {
64 t.Parallel()
65
66 ctx := context.Background()
67 cluster := new(v1beta1.PostgresCluster)
68 cluster.Default()
69 cluster.Spec.ImagePullPolicy = corev1.PullAlways
70 cluster.Spec.PostgresVersion = 11
71
72 parameters := NewParameters().Default
73
74 dataVolume := new(corev1.PersistentVolumeClaim)
75 dataVolume.Name = "datavol"
76
77 instance := new(v1beta1.PostgresInstanceSetSpec)
78 instance.Resources.Requests = corev1.ResourceList{"cpu": resource.MustParse("9m")}
79 instance.Sidecars = &v1beta1.InstanceSidecars{
80 ReplicaCertCopy: &v1beta1.Sidecar{
81 Resources: &corev1.ResourceRequirements{
82 Requests: corev1.ResourceList{"cpu": resource.MustParse("21m")},
83 },
84 },
85 }
86
87 serverSecretProjection := &corev1.SecretProjection{
88 LocalObjectReference: corev1.LocalObjectReference{Name: "srv-secret"},
89 Items: []corev1.KeyToPath{
90 {
91 Key: naming.ReplicationCert,
92 Path: naming.ReplicationCert,
93 },
94 {
95 Key: naming.ReplicationPrivateKey,
96 Path: naming.ReplicationPrivateKey,
97 },
98 {
99 Key: naming.ReplicationCACert,
100 Path: naming.ReplicationCACert,
101 },
102 },
103 }
104
105 clientSecretProjection := &corev1.SecretProjection{
106 LocalObjectReference: corev1.LocalObjectReference{Name: "repl-secret"},
107 Items: []corev1.KeyToPath{
108 {
109 Key: naming.ReplicationCert,
110 Path: naming.ReplicationCertPath,
111 },
112 {
113 Key: naming.ReplicationPrivateKey,
114 Path: naming.ReplicationPrivateKeyPath,
115 },
116 },
117 }
118
119 // without WAL volume nor WAL volume spec
120 pod := new(corev1.PodTemplateSpec)

Callers

nothing calls this directly

Calls 11

MarshalMatchesFunction · 0.92
UnmarshalIntoFunction · 0.92
NewGateFunction · 0.92
NewContextFunction · 0.92
MarshalContainsFunction · 0.92
NewParametersFunction · 0.85
SetFromMapMethod · 0.80
InstancePodFunction · 0.70
DefaultMethod · 0.45
DeepCopyMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected