Fix tests

To have necessary number of replicas set
This commit is contained in:
Dmitrii Dolgov 2020-03-06 13:44:41 +01:00
parent e6f1e8b7fc
commit 2e023799e1
3 changed files with 9 additions and 3 deletions

View File

@ -299,7 +299,7 @@ class EndToEndTestCase(unittest.TestCase):
Scale up from 2 to 3 and back to 2 pods by updating the Postgres manifest at runtime.
'''
k8s = self.k8s
labels = "cluster-name=acid-minimal-cluster"
labels = "application=spilo,cluster-name=acid-minimal-cluster"
k8s.wait_for_pg_to_scale(3)
self.assertEqual(3, k8s.count_pods_with_label(labels))
@ -441,7 +441,7 @@ class EndToEndTestCase(unittest.TestCase):
Add taint "postgres=:NoExecute" to node with master. This must cause a failover.
'''
k8s = self.k8s
cluster_label = 'cluster-name=acid-minimal-cluster'
cluster_label = 'application=spilo,cluster-name=acid-minimal-cluster'
# get nodes of master and replica(s) (expected target of new master)
current_master_node, current_replica_nodes = k8s.get_pg_nodes(cluster_label)
@ -507,7 +507,6 @@ class EndToEndTestCase(unittest.TestCase):
self.assert_master_is_unique()
return new_master_node, new_replica_nodes
>>>>>>> master
def assert_master_is_unique(self, namespace='default', clusterName="acid-minimal-cluster"):
'''

View File

@ -65,6 +65,7 @@ func TestConnPoolSynchronization(t *testing.T) {
ConnPoolDefaultCPULimit: "100m",
ConnPoolDefaultMemoryRequest: "100Mi",
ConnPoolDefaultMemoryLimit: "100Mi",
NumberOfInstances: int32ToPointer(1),
},
},
}, k8sutil.KubernetesClient{}, acidv1.Postgresql{}, logger)

View File

@ -288,6 +288,9 @@ func (mock *mockDeployment) Create(*apiappsv1.Deployment) (*apiappsv1.Deployment
ObjectMeta: metav1.ObjectMeta{
Name: "test-deployment",
},
Spec: apiappsv1.DeploymentSpec{
Replicas: Int32ToPointer(1),
},
}, nil
}
@ -339,6 +342,9 @@ func (mock *mockDeploymentNotExist) Create(*apiappsv1.Deployment) (*apiappsv1.De
ObjectMeta: metav1.ObjectMeta{
Name: "test-deployment",
},
Spec: apiappsv1.DeploymentSpec{
Replicas: Int32ToPointer(1),
},
}, nil
}