(t *testing.T)
| 826 | } |
| 827 | |
| 828 | func 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 | } |
nothing calls this directly
no test coverage detected