mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-04 11:41:33 +02:00
Add sync test
This commit is contained in:
@@ -905,7 +905,7 @@ func (c *Cluster) initSystemUsers() {
|
||||
|
||||
// Connection pooler user is an exception, if requested it's going to be
|
||||
// created by operator as a normal pgUser
|
||||
if c.needMasterConnectionPooler() || c.needReplicaConnectionPooler() {
|
||||
if c.needConnectionPooler() {
|
||||
// initialize empty connection pooler if not done yet
|
||||
if c.Spec.ConnectionPooler == nil {
|
||||
c.Spec.ConnectionPooler = &acidv1.ConnectionPooler{}
|
||||
|
||||
@@ -215,6 +215,23 @@ func TestConnectionPoolerSynchronization(t *testing.T) {
|
||||
defaultInstances: 1,
|
||||
check: objectsAreSaved,
|
||||
},
|
||||
{
|
||||
subTest: "create both master and replica",
|
||||
oldSpec: &acidv1.Postgresql{
|
||||
Spec: acidv1.PostgresSpec{},
|
||||
},
|
||||
newSpec: &acidv1.Postgresql{
|
||||
Spec: acidv1.PostgresSpec{
|
||||
ConnectionPooler: &acidv1.ConnectionPooler{},
|
||||
EnableReplicaConnectionPooler: boolToPointer(true),
|
||||
EnableConnectionPooler: boolToPointer(true),
|
||||
},
|
||||
},
|
||||
cluster: clusterMissingObjects,
|
||||
defaultImage: "pooler:1.0",
|
||||
defaultInstances: 1,
|
||||
check: objectsAreSaved,
|
||||
},
|
||||
{
|
||||
subTest: "delete if not needed",
|
||||
oldSpec: &acidv1.Postgresql{
|
||||
@@ -234,7 +251,8 @@ func TestConnectionPoolerSynchronization(t *testing.T) {
|
||||
subTest: "delete only master if not needed",
|
||||
oldSpec: &acidv1.Postgresql{
|
||||
Spec: acidv1.PostgresSpec{
|
||||
ConnectionPooler: &acidv1.ConnectionPooler{},
|
||||
ConnectionPooler: &acidv1.ConnectionPooler{},
|
||||
EnableConnectionPooler: boolToPointer(true),
|
||||
},
|
||||
},
|
||||
newSpec: &acidv1.Postgresql{
|
||||
|
||||
Reference in New Issue
Block a user