You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: restore_planning_test.go
    path of file: ./repos/cockroach/pkg/ccl/backupccl
    
    the code of the file until where you have to start completion: // Copyright 2023 The Cockroach Authors.
//
// Licensed as a CockroachDB Enterprise file under the Cockroach Community
// License (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
//     https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

package backupccl

import (
	"context"
	"reflect"
	"strings"
	"testing"

	"github.com/cockroachdb/cockroach/pkg/base"
	"github.com/cockroachdb/cockroach/pkg/ccl/backupccl/backuppb"
	"github.com/cockroachdb/cockroach/pkg/clusterversion"
	"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
	"github.com/cockroachdb/cockroach/pkg/roachpb"
	"github.com/cockroachdb/cockroach/pkg/security/username"
	"github.com/cockroachdb/cockroach/pkg/settings/cluster"
	"github.com/cockroachdb/cockroach/pkg/sql"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog/dbdesc"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog/funcdesc"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog/schemadesc"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog/tabledesc"
	"github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc"
	"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
	"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
	"github.com/cockroachdb/cockroach/pkg/util/leaktest"
	"github.com/cockroachdb/cockroach/pkg/util/log"
	"github.com/cockroachdb/errors"
	"github.com/stretchr/testify/require"
	"golang.org/x/exp/slices"
)

// TestRestoreResolveOptionsForJobDescription tests that
// resolveOptionsForRestoreJobDescription handles every field in the
// RestoreOptions struct.
func TestRestoreResolveOptionsForJobDescription(t *testing.T) {
	defer leaktest.AfterTest(t)()

	// The input struct must have a non-zero value for every
	// element of the struct.
	input := tree.RestoreOptions{
		SkipMissingFKs:                   true,
		SkipMissingSequences:             true,
		SkipMissingSequenceOwners:        true,
		SkipMissingViews:                 true,
		SkipMissingUDFs:                  true,
		Detached:                         true,
		SkipLocalitiesCheck:              true,
		DebugPauseOn:                     tree.NewDString("test expr"),
		IncludeAllSecondaryTenants:       tree.DBoolTrue,
		AsTenant:                         tree.NewDStrin
    
func TestBackupManifestVersionCompatibility(t *testing.T) {
	defer leaktest.AfterTest(t)()

	type testCase struct {
		name                    string
		backupVersion           roachpb.Version
		clusterVersion          roachpb.Version
		minimumSupportedVersion roachpb.Version
		expectedError           string
	}

	binaryVersion := roachpb.Version{Major: 23, Minor: 1}
	tests := []testCase{
		{
			name:                    "same-version-restore",
			backupVersion:           roachpb.Version{Major: 23, Minor: 1},
			clusterVersion:          roachpb.Version{Major: 23, Minor: 1},
			minimumSupportedVersion: roachpb.Version{Major: 22, Minor: 2},
		},
		{
			name:                    "previous-version-restore",
			backupVersion:           roachpb.Version{Major: 23, Minor: 1},
			clusterVersion:          roachpb.Version{Major: 23, Minor: 1},
			minimumSupportedVersion: roachpb.Version{Major: 22, Minor: 2},
		},
		{
			name:                    "unfinalized-restore",
			backupVersion:           roachpb.Version{Major: 23, Minor: 1},
			clusterVersion:          roachpb.Version{Major: 22, Minor: 2},
			minimumSupportedVersion: roachpb.Version{Major: 22, Minor: 2},
			expectedError:           "backup from version 23.1 is newer than current version 22.2",
		},
		{
			name:                    "alpha-restore",
			backupVersion:           roachpb.Version{Major: 1000022, Minor: 2, Internal: 14},
			clusterVersion:          roachpb.Version{Major: 23, Minor: 1},
			minimumSupportedVersion: roachpb.Version{Major: 22, Minor: 2},
			expectedError:           "backup from version 1000022.2-upgrading-to-1000023.1-step-014 is newer than current version 23.1",
		},
		{
			name:                    "old-backup",
			backupVersion:           roachpb.Version{Major: 22, Minor: 1},
			clusterVersion:          roachpb.Version{Major: 23, Minor: 1},
			minimumSupportedVersion: roachpb.Version{Major: 22, Minor: 2},
			expectedError:           "backup from version 22.1 is older than the minimum restorable version 22.2",
		},
		{
			name:                    "legacy-version-backup",
			backupVersion:           roachpb.Version{},
			clusterVersion:          roachpb.Version{Major: 23, Minor: 1},
			minimumSupportedVersion: roachpb.Version{Major: 22, Minor: 2},
			expectedError:           "the backup is from a version older than our minimum restorable version 22.2",
		},
	}

	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			settings := cluster.MakeTestingClusterSettingsWithVersions(binaryVersion, tc.minimumSupportedVersion, false)
			require.NoError(t, clusterversion.Initialize(context.Background(), tc.clusterVersion, &settings.SV))
			version := clusterversion.MakeVersionHandleWithOverride(&settings.SV, binaryVersion, tc.minimumSupportedVersion)
			manifest := []backuppb.BackupManifest{{ClusterVersion: tc.backupVersion}}

			err := checkBackupManifestVersionCompatability(context.Background(), version, manifest /*unsafe=*/, false)
			if tc.expectedError == "" {
				require.NoError(t, err)
			} else {
				require.Error(t, err)
				require.Contains(t, err.Error(), tc.expectedError)
			}

			require.NoError(t, checkBackupManifestVersionCompatability(context.Background(), version, manifest /*unsafe=*/, true))
		})
	}
}