Skip to content

Commit

Permalink
backupccl: add datadriven tests for deprecation notice
Browse files Browse the repository at this point in the history
Informs: cockroachdb#78153

Release note: None
  • Loading branch information
adityamaru committed Mar 22, 2022
1 parent 45288c7 commit 548c5e4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/ccl/backupccl/restore_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@ func restorePlanHook(
// Deprecation notice for non-colelction `RESTORE FROM` syntax. Remove this
// once the syntax is deleted in 22.2.
p.BufferClientNotice(ctx,
pgnotice.Newf("Note the `RESTORE FROM <backup>` syntax will be removed in a future release, please"+
"switch over to using `RESTORE FROM <backup> IN <collection>` to restore a particular backup from a collection: %s",
pgnotice.Newf("The `RESTORE FROM <backup>` syntax will be removed in a future release, please"+
" switch over to using `RESTORE FROM <backup> IN <collection>` to restore a particular backup from a collection: %s",
"https://www.cockroachlabs.com/docs/stable/restore.html#view-the-backup-subdirectories"))
}

Expand Down
35 changes: 35 additions & 0 deletions pkg/ccl/backupccl/testdata/backup-restore/feature-flags
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
subtest backup-feature-flags

new-server name=s1
----

Expand Down Expand Up @@ -48,3 +50,36 @@ SET CLUSTER SETTING feature.restore.enabled = TRUE;
exec-sql
RESTORE TABLE d.t FROM LATEST IN 'nodelocal://0/test-root/';
----

subtest end

# TODO(adityamaru): Delete in 22.2 once the syntax is removed. We don't want
# to start a testserver just for this test.
subtest backup-restore-deprecation-notice

exec-sql
BACKUP TO 'nodelocal://1/deprecated';
----
NOTICE: The `BACKUP TO` syntax will be removed in a future release, please switch over to using `BACKUP INTO` to create a backup collection: https://www.cockroachlabs.com/docs/stable/backup.html#considerations. Backups created using the `BACKUP TO` syntax may not be restoreable in the next major version release.

exec-sql
BACKUP TO 'nodelocal://1/deprecated/incfrom' INCREMENTAL FROM 'nodelocal://1/deprecated';
----
NOTICE: The `BACKUP TO` syntax will be removed in a future release, please switch over to using `BACKUP INTO` to create a backup collection: https://www.cockroachlabs.com/docs/stable/backup.html#considerations. Backups created using the `BACKUP TO` syntax may not be restoreable in the next major version release.

exec-sql
DROP TABLE d.t;
----

exec-sql
RESTORE TABLE d.t FROM 'nodelocal://1/deprecated';
----
NOTICE: The `RESTORE FROM <backup>` syntax will be removed in a future release, please switch over to using `RESTORE FROM <backup> IN <collection>` to restore a particular backup from a collection: https://www.cockroachlabs.com/docs/stable/restore.html#view-the-backup-subdirectories


exec-sql
RESTORE SYSTEM USERS FROM 'nodelocal://1/deprecated';
----
NOTICE: The `RESTORE FROM <backup>` syntax will be removed in a future release, please switch over to using `RESTORE FROM <backup> IN <collection>` to restore a particular backup from a collection: https://www.cockroachlabs.com/docs/stable/restore.html#view-the-backup-subdirectories

subtest end

0 comments on commit 548c5e4

Please sign in to comment.