(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestPostgreSQLHBA(t *testing.T) { |
| 19 | ctx := context.Background() |
| 20 | |
| 21 | t.Run("ExporterDisabled", func(t *testing.T) { |
| 22 | inCluster := &v1beta1.PostgresCluster{} |
| 23 | outHBAs := postgres.HBAs{} |
| 24 | PostgreSQLHBAs(ctx, inCluster, &outHBAs) |
| 25 | assert.Equal(t, len(outHBAs.Mandatory), 0) |
| 26 | }) |
| 27 | |
| 28 | t.Run("ExporterEnabled", func(t *testing.T) { |
| 29 | inCluster := &v1beta1.PostgresCluster{} |
| 30 | inCluster.Spec.Monitoring = &v1beta1.MonitoringSpec{ |
| 31 | PGMonitor: &v1beta1.PGMonitorSpec{ |
| 32 | Exporter: &v1beta1.ExporterSpec{ |
| 33 | Image: "image", |
| 34 | }, |
| 35 | }, |
| 36 | } |
| 37 | |
| 38 | outHBAs := postgres.HBAs{} |
| 39 | PostgreSQLHBAs(ctx, inCluster, &outHBAs) |
| 40 | |
| 41 | assert.Equal(t, len(outHBAs.Mandatory), 3) |
| 42 | assert.Equal(t, outHBAs.Mandatory[0].String(), `host all "ccp_monitoring" "127.0.0.0/8" "scram-sha-256"`) |
| 43 | assert.Equal(t, outHBAs.Mandatory[1].String(), `host all "ccp_monitoring" "::1/128" "scram-sha-256"`) |
| 44 | assert.Equal(t, outHBAs.Mandatory[2].String(), `host all "ccp_monitoring" all "reject"`) |
| 45 | }) |
| 46 | } |
| 47 | |
| 48 | func TestPostgreSQLParameters(t *testing.T) { |
| 49 | ctx := context.Background() |
nothing calls this directly
no test coverage detected