MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / TestPostgreSQL

Function TestPostgreSQL

internal/pgbouncer/reconcile_test.go:828–855  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

826}
827
828func TestPostgreSQL(t *testing.T) {
829 t.Parallel()
830
831 cluster := new(v1beta1.PostgresCluster)
832 hbas := new(postgres.HBAs)
833
834 t.Run("Disabled", func(t *testing.T) {
835 PostgreSQL(cluster, hbas)
836
837 // No change when PgBouncer is not requested in the spec.
838 assert.DeepEqual(t, hbas, new(postgres.HBAs))
839 })
840
841 t.Run("Enabled", func(t *testing.T) {
842 cluster.Spec.Proxy = new(v1beta1.PostgresProxySpec)
843 cluster.Spec.Proxy.PGBouncer = new(v1beta1.PGBouncerPodSpec)
844 cluster.Default()
845
846 PostgreSQL(cluster, hbas)
847
848 assert.DeepEqual(t, hbas,
849 &postgres.HBAs{
850 Mandatory: postgresqlHBAs(),
851 },
852 // postgres.HostBasedAuthentication has unexported fields. Call String() to compare.
853 gocmp.Transformer("", (*postgres.HostBasedAuthentication).String))
854 })
855}

Callers

nothing calls this directly

Calls 3

PostgreSQLFunction · 0.85
postgresqlHBAsFunction · 0.85
DefaultMethod · 0.45

Tested by

no test coverage detected