End-to-End Tests

Cloud Native PostgreSQL operator is automatically tested after each commit via a suite of End-to-end (E2E) tests. It ensures that the operator correctly deploys and manages the PostgreSQL clusters.

Moreover, the following Kubernetes versions are tested for each commit, ensuring failure and bugs detection at an early stage of the development process:

  • 1.21
  • 1.20
  • 1.19
  • 1.18
  • 1.17
  • 1.16

The following PostgreSQL versions are tested:

  • PostgreSQL 13
  • PostgreSQL 12
  • PostgreSQL 11
  • PostgreSQL 10

For each tested version of Kubernetes and PostgreSQL, a Kubernetes cluster is created using kind, and the following suite of E2E tests are performed on that cluster:

  • Installation of the operator;
  • Creation of a Cluster;
  • Usage of a persistent volume for data storage;
  • Connection via services, including read-only;
  • Connection via user provided server certificate and client certificate generated by kubectl-cnp;
  • Scale-up and scale-down of a Cluster;
  • Failover;
  • Switchover;
  • Manage PostgreSQL configuration changes;
  • Rolling updates when changing PostgreSQL images;
  • Backup and ScheduledBackups execution;
  • Synchronous replication;
  • Restore from backup;
  • Pod affinity using NodeSelector;
  • Metrics collection;
  • JSON log format;
  • Operator configuration via ConfigMap;
  • Operator pod deletion;
  • Operator pod eviction;
  • Operator upgrade;
  • Operator High Availability;
  • Node drain;
  • Primary endpoint switch in case of failover in less than 10 seconds; the threshold is raised to 20 seconds on GKE and 30 on AKS;
  • Primary endpoint switch in case of switchover in less than 20 seconds;
  • Recover from a degraded state in less than 60 seconds.

The E2E tests suite is also run for OpenShift versions 4.5, 4.6, and 4.7 and the latest Kubernetes and PostgreSQL releases on clusters created on the following services:

  • Google GKE
  • Amazon EKS
  • Microsoft Azure AKS