Add sync test
This commit is contained in:
parent
033a7f4e24
commit
1ee79887cf
|
|
@ -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{
|
||||
|
|
@ -235,6 +252,7 @@ func TestConnectionPoolerSynchronization(t *testing.T) {
|
|||
oldSpec: &acidv1.Postgresql{
|
||||
Spec: acidv1.PostgresSpec{
|
||||
ConnectionPooler: &acidv1.ConnectionPooler{},
|
||||
EnableConnectionPooler: boolToPointer(true),
|
||||
},
|
||||
},
|
||||
newSpec: &acidv1.Postgresql{
|
||||
|
|
|
|||
Loading…
Reference in New Issue