Skip to content

Commit cfa31d3

Browse files
fix(postgres): record the live cluster's flavor on a backup
The chart refuses a flavor change on an existing Cluster, but the Postgres app keeps the refused value. A BackupJob taken after such a change recorded the app's flavor, not the one the data directory was written by, so a RestoreJob would accept a target of the wrong image family and refuse the right one. The driver already reads the live Cluster to keep its barman serverName; it now takes the flavor from that Cluster's imageName the same way the chart's flavor guard compares images. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <[email protected]>
1 parent f714ada commit cfa31d3

3 files changed

Lines changed: 163 additions & 33 deletions

File tree

‎internal/backupcontroller/cnpgstrategy_controller.go‎

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func (r *BackupJobReconciler) reconcileCNPG(ctx context.Context, j *backupsv1alp
281281
serverName = clusterName
282282
}
283283

284-
effectiveServerName, err := r.applyClusterPluginBackup(ctx, j.Namespace, clusterName, rendered, serverName)
284+
effectiveServerName, liveFlavor, err := r.applyClusterPluginBackup(ctx, j.Namespace, clusterName, rendered, serverName)
285285
if err != nil {
286286
if apierrors.IsNotFound(err) {
287287
// HelmRelease has not yet rendered the Cluster (fresh app, or
@@ -307,6 +307,13 @@ func (r *BackupJobReconciler) reconcileCNPG(ctx context.Context, j *backupsv1alp
307307
"cluster", clusterName, "live", effectiveServerName, "strategy", serverName)
308308
serverName = effectiveServerName
309309
}
310+
// The chart refuses a flavor change on a live Cluster, but the app keeps
311+
// the refused value: the Backup records the image family the data was
312+
// written by, which is what a restore has to match.
313+
if specFlavor := cnpgFlavor(app.Spec.Flavor); specFlavor != liveFlavor {
314+
logger.Info("recording the live Cluster's image flavor over the application's",
315+
"cluster", clusterName, "live", liveFlavor, "application", specFlavor)
316+
}
310317

311318
cnpgBackup, err := r.ensureCNPGBackup(ctx, j, clusterName)
312319
if err != nil {
@@ -328,7 +335,7 @@ func (r *BackupJobReconciler) reconcileCNPG(ctx context.Context, j *backupsv1alp
328335
if j.Status.BackupRef != nil {
329336
return ctrl.Result{}, nil
330337
}
331-
artifact, err := r.createCNPGBackupArtifact(ctx, j, resolved, cnpgBackup, clusterName, serverName, rendered, app)
338+
artifact, err := r.createCNPGBackupArtifact(ctx, j, resolved, cnpgBackup, clusterName, serverName, liveFlavor, rendered, app)
332339
if err != nil {
333340
return r.markBackupJobFailed(ctx, j, fmt.Sprintf("failed to create Backup artifact: %v", err))
334341
}
@@ -486,16 +493,20 @@ var cnpgClusterGVR = schema.GroupVersionResource{
486493
// mid-stream splits the archive across two prefixes — WALs around the flip
487494
// land under the old prefix while the base backup indexes under the new one,
488495
// and the eventual restore fails with "WAL not found".
489-
func (r *BackupJobReconciler) applyClusterPluginBackup(ctx context.Context, namespace, clusterName string, t *strategyv1alpha1.CNPGTemplate, serverName string) (string, error) {
490-
// Live read: the cached Cluster can predate a restore re-render, and both
491-
// the serverName and the UID below must come from the current object.
496+
//
497+
// It also returns the flavor of the image the live Cluster runs, read from
498+
// the same object.
499+
func (r *BackupJobReconciler) applyClusterPluginBackup(ctx context.Context, namespace, clusterName string, t *strategyv1alpha1.CNPGTemplate, serverName string) (string, string, error) {
500+
// Live read: the cached Cluster can predate a restore re-render, and the
501+
// serverName, the flavor and the UID below must come from the current
502+
// object.
492503
existing := &cnpgtypes.Cluster{}
493504
live, err := r.Resource(cnpgClusterGVR).Namespace(namespace).Get(ctx, clusterName, metav1.GetOptions{})
494505
if err != nil {
495-
return "", err
506+
return "", "", err
496507
}
497508
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(live.Object, existing); err != nil {
498-
return "", fmt.Errorf("decode Cluster %s/%s: %w", namespace, clusterName, err)
509+
return "", "", fmt.Errorf("decode Cluster %s/%s: %w", namespace, clusterName, err)
499510
}
500511
if live := currentBarmanServerName(existing); live != "" {
501512
serverName = live
@@ -527,15 +538,15 @@ func (r *BackupJobReconciler) applyClusterPluginBackup(ctx context.Context, name
527538
InstanceSidecarConfiguration: barmanSidecarConfiguration(),
528539
}
529540
if err := r.Patch(ctx, objStore, client.Apply, client.FieldOwner(cnpgFieldManager), client.ForceOwnership); err != nil {
530-
return "", fmt.Errorf("apply ObjectStore %s/%s: %w", namespace, objStoreName, err)
541+
return "", "", fmt.Errorf("apply ObjectStore %s/%s: %w", namespace, objStoreName, err)
531542
}
532543

533544
patch := newCNPGClusterPatch(namespace, clusterName)
534545
patch.Spec.Plugins = []cnpgtypes.PluginConfiguration{buildBarmanPlugin(objStoreName, serverName)}
535546
if err := r.Patch(ctx, patch, client.Apply, client.FieldOwner(cnpgFieldManager), client.ForceOwnership); err != nil {
536-
return "", err
547+
return "", "", err
537548
}
538-
return serverName, nil
549+
return serverName, cnpgImageFlavor(existing.Spec.ImageName), nil
539550
}
540551

541552
// currentBarmanServerName returns the serverName the Cluster's barman-cloud
@@ -620,7 +631,7 @@ func (r *BackupJobReconciler) createCNPGBackupArtifact(
620631
j *backupsv1alpha1.BackupJob,
621632
resolved *ResolvedBackupConfig,
622633
cnpgBackup *cnpgtypes.Backup,
623-
clusterName, serverName string,
634+
clusterName, serverName, flavor string,
624635
rendered *strategyv1alpha1.CNPGTemplate,
625636
sourceApp *postgresapp.Postgres,
626637
) (*backupsv1alpha1.Backup, error) {
@@ -640,7 +651,7 @@ func (r *BackupJobReconciler) createCNPGBackupArtifact(
640651
driverMD[cnpgS3SecretRefKey] = rendered.BarmanObjectStore.S3Credentials.SecretRef.Name
641652
}
642653

643-
underlyingResources, err := marshalCNPGBackupSnapshot(sourceApp, resolved.Parameters)
654+
underlyingResources, err := marshalCNPGBackupSnapshot(sourceApp, resolved.Parameters, flavor)
644655
if err != nil {
645656
return nil, fmt.Errorf("encode source snapshot for Backup.status.underlyingResources: %w", err)
646657
}
@@ -1409,7 +1420,9 @@ var cnpgBackupSnapshotAPIVersion = backupsv1alpha1.GroupVersion.String()
14091420
// marshalCNPGBackupSnapshot serializes the source app's spec.databases /
14101421
// spec.users plus the BackupClassStrategy parameters into a
14111422
// runtime.RawExtension suitable for Backup.Status.UnderlyingResources.
1412-
func marshalCNPGBackupSnapshot(app *postgresapp.Postgres, parameters map[string]string) (*runtime.RawExtension, error) {
1423+
// flavor is the live Cluster's, not app.Spec.Flavor: the chart refuses a
1424+
// flavor change, but the app keeps the refused value.
1425+
func marshalCNPGBackupSnapshot(app *postgresapp.Postgres, parameters map[string]string, flavor string) (*runtime.RawExtension, error) {
14131426
if app == nil {
14141427
return nil, nil
14151428
}
@@ -1419,7 +1432,7 @@ func marshalCNPGBackupSnapshot(app *postgresapp.Postgres, parameters map[string]
14191432
Databases: app.Spec.Databases,
14201433
Users: app.Spec.Users,
14211434
Parameters: parameters,
1422-
Flavor: app.Spec.Flavor,
1435+
Flavor: flavor,
14231436
}
14241437
raw, err := json.Marshal(snap)
14251438
if err != nil {
@@ -1463,6 +1476,19 @@ func cnpgFlavor(flavor string) string {
14631476
return flavor
14641477
}
14651478

1479+
// cnpgImageFlavor names the flavor of a Cluster's spec.imageName the way the
1480+
// chart's postgres.flavorGuard compares images: the last path segment without
1481+
// tag or digest, so a registry mirror rewriting the host still matches. The
1482+
// chart names each flavor after its image; an empty imageName is CNPG's
1483+
// default postgresql image.
1484+
func cnpgImageFlavor(imageName string) string {
1485+
name := imageName[strings.LastIndex(imageName, "/")+1:]
1486+
if i := strings.IndexAny(name, ":@"); i >= 0 {
1487+
name = name[:i]
1488+
}
1489+
return cnpgFlavor(name)
1490+
}
1491+
14661492
// purgeExistingCluster deletes the live cnpg.io Cluster and its PVCs so the
14671493
// chart-rendered Cluster can re-bootstrap from S3. Used only by the in-place
14681494
// restore variant.

‎internal/backupcontroller/cnpgstrategy_controller_test.go‎

Lines changed: 119 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func TestRenderCNPGTemplate_RoundTripsParametersThroughSnapshot(t *testing.T) {
225225
}
226226

227227
// Round-trip parameters through Backup.status.underlyingResources.
228-
raw, err := marshalCNPGBackupSnapshot(app, parameters)
228+
raw, err := marshalCNPGBackupSnapshot(app, parameters, "")
229229
if err != nil {
230230
t.Fatalf("marshal snapshot: %v", err)
231231
}
@@ -880,7 +880,7 @@ func TestMarshalUnmarshalCNPGBackupSnapshot(t *testing.T) {
880880
"region": "eu-west-1",
881881
}
882882

883-
raw, err := marshalCNPGBackupSnapshot(src, parameters)
883+
raw, err := marshalCNPGBackupSnapshot(src, parameters, "")
884884
if err != nil {
885885
t.Fatalf("marshal: %v", err)
886886
}
@@ -1033,7 +1033,7 @@ func TestCreateCNPGBackupArtifact_AlreadyExistsReturnsExisting(t *testing.T) {
10331033
}
10341034

10351035
sourceApp := newPostgresApp("pg", "tenant")
1036-
got, err := r.createCNPGBackupArtifact(context.Background(), j, resolved, cnpgBk, "postgres-pg", "postgres-pg", rendered, sourceApp)
1036+
got, err := r.createCNPGBackupArtifact(context.Background(), j, resolved, cnpgBk, "postgres-pg", "postgres-pg", "postgresql", rendered, sourceApp)
10371037
if err != nil {
10381038
t.Fatalf("expected AlreadyExists to be swallowed, got error %v", err)
10391039
}
@@ -1059,7 +1059,7 @@ func TestApplyClusterPluginBackup_NotFoundOnMissingCluster(t *testing.T) {
10591059
},
10601060
}
10611061

1062-
_, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-missing", tmpl, "postgres-missing")
1062+
_, _, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-missing", tmpl, "postgres-missing")
10631063
if err == nil {
10641064
t.Fatalf("expected NotFound error, got nil")
10651065
}
@@ -1697,7 +1697,7 @@ func TestApplyClusterPluginBackup_ReadsTheLiveClusterNotTheCache(t *testing.T) {
16971697
BarmanObjectStore: strategyv1alpha1.BarmanObjectStoreTemplate{DestinationPath: "s3://bucket/x/"},
16981698
}
16991699

1700-
got, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-app", tmpl, "strategy-name")
1700+
got, _, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-app", tmpl, "strategy-name")
17011701
if err != nil {
17021702
t.Fatalf("unexpected error: %v", err)
17031703
}
@@ -1718,6 +1718,108 @@ func TestApplyClusterPluginBackup_ReadsTheLiveClusterNotTheCache(t *testing.T) {
17181718
}
17191719
}
17201720

1721+
// TestReconcileCNPG_RecordsTheLiveClusterFlavor: the chart refuses a flavor
1722+
// change on a live Cluster, but the Postgres app keeps the refused value. The
1723+
// Backup must record the flavor the Cluster actually runs, or a restore would
1724+
// accept a target of the wrong image family and refuse the right one.
1725+
func TestReconcileCNPG_RecordsTheLiveClusterFlavor(t *testing.T) {
1726+
apiGroup := backupsv1alpha1.DefaultApplicationAPIGroup
1727+
strategyGroup := strategyv1alpha1.GroupVersion.Group
1728+
const ns, appName = "tenant", "pg"
1729+
clusterName := cnpgClusterNameForApp(appName)
1730+
1731+
cases := []struct {
1732+
name string
1733+
liveImage string
1734+
specFlavor string
1735+
want string
1736+
}{
1737+
{name: "app switched to postgis on a postgresql cluster", liveImage: "ghcr.io/cloudnative-pg/postgresql:17.5", specFlavor: "postgis", want: "postgresql"},
1738+
{name: "app switched to postgresql on a postgis cluster", liveImage: "ghcr.io/cloudnative-pg/postgis:17-3.5", specFlavor: "", want: "postgis"},
1739+
{name: "cluster on the CNPG default image", liveImage: "", specFlavor: "postgis", want: "postgresql"},
1740+
}
1741+
for _, tc := range cases {
1742+
t.Run(tc.name, func(t *testing.T) {
1743+
startedAt := metav1.Now()
1744+
job := &backupsv1alpha1.BackupJob{
1745+
ObjectMeta: metav1.ObjectMeta{Namespace: ns, Name: "bj"},
1746+
Spec: backupsv1alpha1.BackupJobSpec{
1747+
ApplicationRef: corev1.TypedLocalObjectReference{APIGroup: &apiGroup, Kind: postgresAppKind, Name: appName},
1748+
},
1749+
Status: backupsv1alpha1.BackupJobStatus{StartedAt: &startedAt},
1750+
}
1751+
strategy := &strategyv1alpha1.CNPG{
1752+
ObjectMeta: metav1.ObjectMeta{Name: "cnpg-strategy"},
1753+
Spec: strategyv1alpha1.CNPGSpec{
1754+
Template: strategyv1alpha1.CNPGTemplate{
1755+
BarmanObjectStore: strategyv1alpha1.BarmanObjectStoreTemplate{DestinationPath: "s3://bucket/"},
1756+
},
1757+
},
1758+
}
1759+
app := newPostgresApp(appName, ns)
1760+
app.Spec.Flavor = tc.specFlavor
1761+
cluster := &cnpgtypes.Cluster{
1762+
ObjectMeta: metav1.ObjectMeta{Namespace: ns, Name: clusterName, UID: "cluster-uid"},
1763+
Spec: cnpgtypes.ClusterSpec{ImageName: tc.liveImage},
1764+
}
1765+
cnpgBackup := &cnpgtypes.Backup{
1766+
ObjectMeta: metav1.ObjectMeta{Namespace: ns, Name: "bj-cnpg", Labels: map[string]string{
1767+
backupsv1alpha1.OwningJobNameLabel: job.Name,
1768+
backupsv1alpha1.OwningJobNamespaceLabel: job.Namespace,
1769+
}},
1770+
Spec: cnpgtypes.BackupSpec{Cluster: cnpgtypes.ClusterReference{Name: clusterName}},
1771+
Status: cnpgtypes.BackupStatus{Phase: cnpgBackupPhaseComplete},
1772+
}
1773+
c := newCNPGStrategyTestClient(t, job, strategy, app, cluster, cnpgBackup)
1774+
r := &BackupJobReconciler{Client: c, Interface: cnpgDynamicFor(t, cluster)}
1775+
resolved := &ResolvedBackupConfig{
1776+
StrategyRef: corev1.TypedLocalObjectReference{APIGroup: &strategyGroup, Kind: strategyv1alpha1.CNPGStrategyKind, Name: strategy.Name},
1777+
}
1778+
1779+
j := &backupsv1alpha1.BackupJob{}
1780+
if err := c.Get(context.Background(), client.ObjectKeyFromObject(job), j); err != nil {
1781+
t.Fatalf("get BackupJob: %v", err)
1782+
}
1783+
if _, err := r.reconcileCNPG(context.Background(), j, resolved); err != nil {
1784+
t.Fatalf("reconcileCNPG: %v", err)
1785+
}
1786+
if j.Status.Phase != backupsv1alpha1.BackupJobPhaseSucceeded {
1787+
t.Fatalf("BackupJob phase = %q (%s), want Succeeded", j.Status.Phase, j.Status.Message)
1788+
}
1789+
1790+
backup := &backupsv1alpha1.Backup{}
1791+
if err := c.Get(context.Background(), client.ObjectKey{Namespace: ns, Name: job.Name}, backup); err != nil {
1792+
t.Fatalf("get Backup artifact: %v", err)
1793+
}
1794+
snap, err := unmarshalCNPGBackupSnapshot(backup)
1795+
if err != nil {
1796+
t.Fatalf("unmarshal snapshot: %v", err)
1797+
}
1798+
if got := cnpgFlavor(snap.Flavor); got != tc.want {
1799+
t.Fatalf("Backup records flavor %q, want the live Cluster's %q", got, tc.want)
1800+
}
1801+
})
1802+
}
1803+
}
1804+
1805+
// TestCNPGImageFlavor pins the image-to-flavor mapping to the chart's
1806+
// postgres.flavorGuard: only the image name counts, never the host, tag or
1807+
// digest.
1808+
func TestCNPGImageFlavor(t *testing.T) {
1809+
cases := map[string]string{
1810+
"": "postgresql",
1811+
"ghcr.io/cloudnative-pg/postgresql:18.1": "postgresql",
1812+
"ghcr.io/cloudnative-pg/postgis:18-3.6": "postgis",
1813+
"mirror.local:5000/cloudnative-pg/postgis:18-3.6@sha256:0123": "postgis",
1814+
"postgis@sha256:0123": "postgis",
1815+
}
1816+
for image, want := range cases {
1817+
if got := cnpgImageFlavor(image); got != want {
1818+
t.Errorf("cnpgImageFlavor(%q) = %q, want %q", image, got, want)
1819+
}
1820+
}
1821+
}
1822+
17211823
// cnpgDynamicFor builds the dynamic client applyClusterPluginBackup reads
17221824
// Clusters through, seeded independently of the typed client.
17231825
func cnpgDynamicFor(t *testing.T, clusters ...*cnpgtypes.Cluster) dynamic.Interface {
@@ -1805,7 +1907,7 @@ func TestApplyClusterPluginBackup_PreservesLiveServerName(t *testing.T) {
18051907
BarmanObjectStore: strategyv1alpha1.BarmanObjectStoreTemplate{DestinationPath: "s3://bucket/x/"},
18061908
}
18071909

1808-
got, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-app", tmpl, "strategy-name")
1910+
got, _, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-app", tmpl, "strategy-name")
18091911
if err != nil {
18101912
t.Fatalf("unexpected error: %v", err)
18111913
}
@@ -1844,7 +1946,7 @@ func TestApplyClusterPluginBackup_PatchesExistingCluster(t *testing.T) {
18441946
},
18451947
}
18461948

1847-
if _, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-app", tmpl, "tenant-app"); err != nil {
1949+
if _, _, err := r.applyClusterPluginBackup(context.Background(), "tenant", "postgres-app", tmpl, "tenant-app"); err != nil {
18481950
t.Fatalf("unexpected error: %v", err)
18491951
}
18501952

@@ -2177,7 +2279,7 @@ func TestReconcileCNPGRestore_RepeatInPlacePurgesStaleRecoveryCluster(t *testing
21772279

21782280
mkBackupArtifact := func(t *testing.T) *backupsv1alpha1.Backup {
21792281
t.Helper()
2180-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
2282+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
21812283
if err != nil {
21822284
t.Fatalf("marshal snapshot: %v", err)
21832285
}
@@ -2338,9 +2440,7 @@ func TestReconcileCNPGRestore_RefusesCrossFlavorRestore(t *testing.T) {
23382440
}
23392441
for _, tc := range cases {
23402442
t.Run(tc.name, func(t *testing.T) {
2341-
source := newPostgresApp(appName, ns)
2342-
source.Spec.Flavor = tc.sourceFlavor
2343-
snap, err := marshalCNPGBackupSnapshot(source, nil)
2443+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, tc.sourceFlavor)
23442444
if err != nil {
23452445
t.Fatalf("marshal snapshot: %v", err)
23462446
}
@@ -2440,7 +2540,7 @@ func TestReconcileCNPGRestore_HealthyClusterSucceeds(t *testing.T) {
24402540
ctx := context.Background()
24412541
startedAt := metav1.NewTime(time.Now())
24422542

2443-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
2543+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
24442544
if err != nil {
24452545
t.Fatalf("marshal snapshot: %v", err)
24462546
}
@@ -2559,7 +2659,7 @@ func TestReconcileCNPGRestore_HealthyDisablesBootstrap(t *testing.T) {
25592659
ctx := context.Background()
25602660
startedAt := metav1.NewTime(time.Now().Add(-time.Hour))
25612661

2562-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
2662+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
25632663
if err != nil {
25642664
t.Fatalf("marshal snapshot: %v", err)
25652665
}
@@ -2648,7 +2748,7 @@ func TestReconcileCNPGRestore_BootstrapDisableFailsPastDeadline(t *testing.T) {
26482748
// Well past the 30m default deadline.
26492749
startedAt := metav1.NewTime(time.Now().Add(-72 * time.Hour))
26502750

2651-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
2751+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
26522752
if err != nil {
26532753
t.Fatalf("marshal snapshot: %v", err)
26542754
}
@@ -2761,7 +2861,7 @@ func TestReconcileCNPGRestore_BootstrapDisableTransientErrorRequeues(t *testing.
27612861
startedAt := metav1.NewTime(time.Now().Add(-72 * time.Hour))
27622862
convergedAt := metav1.Now()
27632863

2764-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
2864+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
27652865
if err != nil {
27662866
t.Fatalf("marshal snapshot: %v", err)
27672867
}
@@ -2888,7 +2988,7 @@ func TestReconcileCNPGRestore_BootstrapDisableShortTimeoutHonorsGraceFloor(t *te
28882988
// within the 5m post-convergence floor.
28892989
convergedAt := metav1.NewTime(time.Now().Add(-90 * time.Second))
28902990

2891-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
2991+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
28922992
if err != nil {
28932993
t.Fatalf("marshal snapshot: %v", err)
28942994
}
@@ -3000,7 +3100,7 @@ func TestReconcileCNPGRestore_HealthyPastDeadlineSucceeds(t *testing.T) {
30003100
// Far past the 30m default deadline: this is the reconcile-gap case.
30013101
startedAt := metav1.NewTime(time.Now().Add(-72 * time.Hour))
30023102

3003-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
3103+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
30043104
if err != nil {
30053105
t.Fatalf("marshal snapshot: %v", err)
30063106
}
@@ -3096,7 +3196,7 @@ func TestReconcileCNPGRestore_DeadlineClassifiesRecoveryTargetUnreachable(t *tes
30963196
// enters the deadline-classification branch.
30973197
startedAt := metav1.NewTime(time.Now().Add(-72 * time.Hour))
30983198

3099-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
3199+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
31003200
if err != nil {
31013201
t.Fatalf("marshal snapshot: %v", err)
31023202
}
@@ -3435,7 +3535,7 @@ func TestReconcileCNPGRestore_PinsTheRequestedBackup(t *testing.T) {
34353535

34363536
mkBackupArtifact := func(t *testing.T) *backupsv1alpha1.Backup {
34373537
t.Helper()
3438-
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil)
3538+
snap, err := marshalCNPGBackupSnapshot(newPostgresApp(appName, ns), nil, "")
34393539
if err != nil {
34403540
t.Fatalf("marshal snapshot: %v", err)
34413541
}

0 commit comments

Comments
 (0)