Skip to content

Commit

Permalink
Merge branch 'main' into K8SPG-637
Browse files Browse the repository at this point in the history
  • Loading branch information
hors authored Jan 23, 2025
2 parents 8b268d6 + 67d3e15 commit f21b507
Show file tree
Hide file tree
Showing 23 changed files with 131 additions and 70 deletions.
10 changes: 8 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,14 @@ void checkE2EIgnoreFiles() {
echo "This is the first run. Using merge base as the starting point for the diff."
changedFiles = sh(script: "git diff --name-only \$(git merge-base HEAD origin/$CHANGE_TARGET)", returnStdout: true).trim().split('\n').findAll{it}
} else {
echo "Processing changes since last processed commit: $lastProcessedCommitHash"
changedFiles = sh(script: "git diff --name-only $lastProcessedCommitHash HEAD", returnStdout: true).trim().split('\n').findAll{it}
def commitExists = sh(script: "git cat-file -e $lastProcessedCommitHash 2>/dev/null", returnStatus: true) == 0
if (commitExists) {
echo "Processing changes since last processed commit: $lastProcessedCommitHash"
changedFiles = sh(script: "git diff --name-only $lastProcessedCommitHash HEAD", returnStdout: true).trim().split('\n').findAll{it}
} else {
echo "Commit hash $lastProcessedCommitHash does not exist in the current repository. Using merge base as the starting point for the diff."
changedFiles = sh(script: "git diff --name-only \$(git merge-base HEAD origin/$CHANGE_TARGET)", returnStdout: true).trim().split('\n').findAll{it}
}
}

echo "Excluded files: $excludedFiles"
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/xdg-go/stringprep v1.0.4
go.nhat.io/grpcmock v0.28.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0
go.opentelemetry.io/otel v1.34.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.33.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0
go.opentelemetry.io/otel/sdk v1.34.0
go.opentelemetry.io/otel/trace v1.34.0
go.uber.org/zap v1.27.0
Expand All @@ -36,7 +36,7 @@ require (
k8s.io/apimachinery v0.32.1
k8s.io/client-go v0.32.1
k8s.io/component-base v0.32.1
sigs.k8s.io/controller-runtime v0.19.4
sigs.k8s.io/controller-runtime v0.20.0
sigs.k8s.io/yaml v1.4.0
)

Expand All @@ -45,6 +45,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
Expand All @@ -56,7 +57,7 @@ require (

require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.55.5
github.com/aws/aws-sdk-go v1.55.6
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/bool64/shared v0.1.5 // indirect
Expand Down Expand Up @@ -111,7 +112,6 @@ require (
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sync v0.10.0 // indirect
Expand All @@ -126,7 +126,7 @@ require (
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/apiextensions-apiserver v0.32.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down Expand Up @@ -89,6 +89,8 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -237,16 +239,16 @@ go.nhat.io/wait v0.1.0 h1:aQ4YDzaOgFbypiJ9c/eAfOIB1G25VOv7Gd2QS8uz1gw=
go.nhat.io/wait v0.1.0/go.mod h1:+ijMghc9/9zXi+HDcs49HNReprvXOZha2Q3jTOtqJrE=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 h1:yd02MEjBdJkG3uabWP9apV+OuWRIXGDuJEUJbOHmCFU=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I=
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx69E/Y/DcQSMPpKANYVMQ7fBA=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 h1:wpMfgF8E1rkrT1Z6meFh1NDtownE9Ii3n3X2GJYjsaU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0/go.mod h1:wAy0T/dUbs468uOlkT31xjvqQgEVXv58BRFWEgn5v/0=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.33.0 h1:W5AWUn/IVe8RFb5pZx1Uh9Laf/4+Qmm4kJL5zPuvR+0=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.33.0/go.mod h1:mzKxJywMNBdEX8TSJais3NnsVZUaJ+bAy6UxPTng2vk=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0 h1:jBpDk4HAUsrnVO1FsfCfCOTEc/MkInJmvfCHYLFiT80=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.34.0/go.mod h1:H9LUIM1daaeZaz91vZcfeM0fejXPmgCYE8ZhzqfJuiU=
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
Expand Down Expand Up @@ -274,8 +276,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down Expand Up @@ -394,8 +394,8 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc=
k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k=
k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk=
k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk=
k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0=
k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw=
k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs=
k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU=
Expand All @@ -408,8 +408,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo=
sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs=
sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/postgrescluster/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r *Reconciler) Reconcile(
// Set any defaults that may not have been stored in the API. No DeepCopy
// is necessary because controller-runtime makes a copy before returning
// from its cache.
cluster.Default()
_ = cluster.Default(ctx, nil)

if cluster.Spec.OpenShift == nil {
cluster.Spec.OpenShift = &r.IsOpenShift
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/postgrescluster/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
ctx := context.Background()
cluster := v1beta1.PostgresCluster{}
cluster.Name = "hippo"
cluster.Default()
err := cluster.Default(ctx, nil)
assert.NilError(t, err)
cluster.SetLabels(map[string]string{
naming.LabelVersion: "2.5.0",
})
Expand Down Expand Up @@ -1725,7 +1726,8 @@ func TestGenerateInstanceStatefulSetIntent(t *testing.T) {
cluster = testCluster()
}

cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.UID = types.UID("hippouid")
cluster.Namespace = test.name + "-ns"
cluster.Spec.Shutdown = &test.ip.shutdown
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/postgrescluster/pgbouncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ namespace: ns3
cluster.Spec.Proxy = &v1beta1.PostgresProxySpec{
PGBouncer: &v1beta1.PGBouncerPodSpec{},
}
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

configmap := &corev1.ConfigMap{}
configmap.Name = "some-cm2"
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/postgrescluster/pgmonitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ func TestReconcileMonitoringSecret(t *testing.T) {
reconciler := &Reconciler{Client: cc, Owner: client.FieldOwner(t.Name())}

cluster := testCluster()
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.UID = types.UID("hippouid")
cluster.Namespace = setupNamespace(t, cc).Name

Expand Down Expand Up @@ -787,7 +788,8 @@ func TestReconcileExporterQueriesConfig(t *testing.T) {
reconciler := &Reconciler{Client: cc, Owner: client.FieldOwner(t.Name())}

cluster := testCluster()
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.UID = types.UID("hippouid")
cluster.Namespace = setupNamespace(t, cc).Name

Expand Down
2 changes: 1 addition & 1 deletion internal/controller/standalone_pgadmin/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *PGAdminReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
log.V(1).Info("Reconciling pgAdmin")

// Set defaults if unset
pgAdmin.Default()
_ = pgAdmin.Default(ctx, nil)

var (
configmap *corev1.ConfigMap
Expand Down
13 changes: 9 additions & 4 deletions internal/patroni/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package patroni

import (
"context"
"os"
"os/exec"
"path/filepath"
Expand All @@ -29,7 +30,8 @@ func TestClusterYAML(t *testing.T) {

t.Run("PG version defaulted", func(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Namespace = "some-namespace"
cluster.Name = "cluster-name"

Expand Down Expand Up @@ -86,7 +88,8 @@ watchdog:

t.Run(">PG10", func(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Namespace = "some-namespace"
cluster.Name = "cluster-name"
cluster.Spec.PostgresVersion = 14
Expand Down Expand Up @@ -759,7 +762,8 @@ func TestDynamicConfiguration(t *testing.T) {
if cluster.Spec.PostgresVersion == 0 {
cluster.Spec.PostgresVersion = 14
}
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
actual := DynamicConfiguration(cluster, tt.input, tt.hbas, tt.params)
assert.DeepEqual(t, tt.expected, actual)
})
Expand Down Expand Up @@ -792,7 +796,8 @@ func TestInstanceEnvironment(t *testing.T) {
t.Parallel()

cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Spec.PostgresVersion = 12
leaderService := new(corev1.Service)
podService := new(corev1.Service)
Expand Down
4 changes: 3 additions & 1 deletion internal/patroni/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package patroni

import (
"context"
"testing"

"gotest.tools/v3/assert"
Expand All @@ -28,7 +29,8 @@ func isUniqueAndSorted(slice []string) bool {

func TestPermissions(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

t.Run("Upstream", func(t *testing.T) {
permissions := Permissions(cluster)
Expand Down
6 changes: 4 additions & 2 deletions internal/patroni/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func TestClusterConfigMap(t *testing.T) {
pgHBAs := postgres.HBAs{}
pgParameters := postgres.Parameters{}

cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
config := new(corev1.ConfigMap)
assert.NilError(t, ClusterConfigMap(ctx, cluster, pgHBAs, pgParameters, config))

Expand Down Expand Up @@ -114,7 +115,8 @@ func TestInstancePod(t *testing.T) {
t.Parallel()

cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Name = "some-such"
cluster.Spec.PostgresVersion = 11
cluster.Spec.Image = "image"
Expand Down
10 changes: 7 additions & 3 deletions internal/pgadmin/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package pgadmin

import (
"context"
"testing"

"gotest.tools/v3/assert"
Expand Down Expand Up @@ -33,7 +34,8 @@ func TestConfigMap(t *testing.T) {
t.Run("Defaults", func(t *testing.T) {
cluster.Spec.UserInterface = new(v1beta1.UserInterfaceSpec)
cluster.Spec.UserInterface.PGAdmin = new(v1beta1.PGAdminPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

assert.NilError(t, ConfigMap(cluster, config))

Expand All @@ -52,7 +54,8 @@ pgadmin-settings.json: |
"some": "thing",
"UPPER_CASE": false,
}
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

assert.NilError(t, ConfigMap(cluster, config))

Expand Down Expand Up @@ -92,7 +95,8 @@ func TestPod(t *testing.T) {
t.Run("Defaults", func(t *testing.T) {
cluster.Spec.UserInterface = new(v1beta1.UserInterfaceSpec)
cluster.Spec.UserInterface.PGAdmin = new(v1beta1.PGAdminPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

call()

Expand Down
4 changes: 3 additions & 1 deletion internal/pgbackrest/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package pgbackrest

import (
"context"
"testing"

"gotest.tools/v3/assert"
Expand All @@ -28,7 +29,8 @@ func isUniqueAndSorted(slice []string) bool {

func TestPermissions(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

permissions := Permissions(cluster)
for _, rule := range permissions {
Expand Down
Loading

0 comments on commit f21b507

Please sign in to comment.