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: backup_test.go
    path of file: ./repos/cockroach/pkg/ccl/backupccl
    
    the code of the file until where you have to start completion: // Copyright 2016 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 (
	"bytes"
	"context"
	gosql "database/sql"
	"encoding/base64"
	"encoding/hex"
	"fmt"
	"hash/crc32"
	"io"
	"math"
	"math/rand"
	"net/url"
	"os"
	"path"
	"path/filepath"
	"reflect"
	"regexp"
	"strconv"
	"strings"
	"sync/atomic"
	"sysca
    
func TestRestoreJobRetryReset(t *testing.T) {
	defer leaktest.AfterTest(t)()
	defer log.Scope(t).Close(t)

	mu := struct {
		syncutil.Mutex
		initialScanComplete bool
		retryCount          int
	}{}
	waitForProgress := make(chan struct{})

	maxRetries := 4

	params := base.TestClusterArgs{}
	knobs := base.TestingKnobs{
		BackupRestore: &sql.BackupRestoreTestingKnobs{
			RestoreDistSQLRetryPolicy: &retry.Options{
				InitialBackoff: time.Microsecond,
				Multiplier:     2,
				MaxBackoff:     2 * time.Microsecond,
				MaxRetries:     maxRetries,
			},
			RunBeforeRestoreFlow: func() error {
				mu.Lock()
				defer mu.Unlock()
				if mu.retryCount >= maxRetries-1 {
					return nil
				}
				mu.retryCount++
				// Send a retryable error
				return syscall.ECONNRESET
			},
			RunAfterRestoreFlow: func() error {
				mu.Lock()
				defer mu.Unlock()
				// Wait for progress to persist, then continue sending retryable errors
				<-waitForProgress
				mu.retryCount++
				// Send a retryable error
				return syscall.ECONNRESET
			},
		},
		JobsTestingKnobs: jobs.NewTestingKnobsWithShortIntervals(),
	}
	params.ServerArgs = base.TestServerArgs{Knobs: knobs}

	_, sqlDB, _, cleanupFn := backupRestoreTestSetupWithParams(t, singleNode, 10, InitManualReplication, params)
	defer cleanupFn()

	sqlDB.Exec(t, `BACKUP DATABASE data INTO $1`, localFoo)
	var restoreJobId jobspb.JobID
	sqlDB.QueryRow(t, `RESTORE DATABASE DATA FROM LATEST IN $1 with new_db_name=d2, detached`, localFoo).Scan(&restoreJobId)
	testutils.SucceedsSoon(t, func() error {
		jobProgress := jobutils.GetJobProgress(t, sqlDB, restoreJobId)
		if len(jobProgress.GetRestore().Checkpoint) == 0 {
			return errors.Newf("frontier has not advanced yet")
		}
		return nil
	})
	close(waitForProgress)

	jobutils.WaitForJobToPause(t, sqlDB, restoreJobId)

	require.Greater(t, mu.retryCount, maxRetries+2)
}