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
|
// Connection pooler user is an exception, if requested it's going to be
|
||||||
// created by operator as a normal pgUser
|
// created by operator as a normal pgUser
|
||||||
if c.needMasterConnectionPooler() || c.needReplicaConnectionPooler() {
|
if c.needConnectionPooler() {
|
||||||
// initialize empty connection pooler if not done yet
|
// initialize empty connection pooler if not done yet
|
||||||
if c.Spec.ConnectionPooler == nil {
|
if c.Spec.ConnectionPooler == nil {
|
||||||
c.Spec.ConnectionPooler = &acidv1.ConnectionPooler{}
|
c.Spec.ConnectionPooler = &acidv1.ConnectionPooler{}
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,23 @@ func TestConnectionPoolerSynchronization(t *testing.T) {
|
||||||
defaultInstances: 1,
|
defaultInstances: 1,
|
||||||
check: objectsAreSaved,
|
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",
|
subTest: "delete if not needed",
|
||||||
oldSpec: &acidv1.Postgresql{
|
oldSpec: &acidv1.Postgresql{
|
||||||
|
|
@ -234,7 +251,8 @@ func TestConnectionPoolerSynchronization(t *testing.T) {
|
||||||
subTest: "delete only master if not needed",
|
subTest: "delete only master if not needed",
|
||||||
oldSpec: &acidv1.Postgresql{
|
oldSpec: &acidv1.Postgresql{
|
||||||
Spec: acidv1.PostgresSpec{
|
Spec: acidv1.PostgresSpec{
|
||||||
ConnectionPooler: &acidv1.ConnectionPooler{},
|
ConnectionPooler: &acidv1.ConnectionPooler{},
|
||||||
|
EnableConnectionPooler: boolToPointer(true),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
newSpec: &acidv1.Postgresql{
|
newSpec: &acidv1.Postgresql{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue