Skip to content

Commit

Permalink
remove redundant function from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Sep 25, 2023
1 parent a054bb8 commit db55f84
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions end_to_end/end_to_end_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,43 +420,6 @@ func extractSavedTarFile(backupDir string, tarBaseName string) string {
return extractDirectory
}

// Move extracted data files to the proper directory for a larger-to-smaller restore, if necessary
// Assumes all saved backups have a name in the format "N-segment-db-..." where N is the original cluster size
func moveSegmentBackupFiles(tarBaseName string, extractDirectory string, isMultiNode bool, timestamps ...string) {
re := regexp.MustCompile("^([0-9]+)-.*")
origSize, _ := strconv.Atoi(re.FindStringSubmatch(tarBaseName)[1])
for _, ts := range timestamps {
if ts != "" {
baseDir := fmt.Sprintf("%s/demoDataDir%s/backups/%s/%s", extractDirectory, "%d", ts[0:8], ts)
if isMultiNode {
remoteOutput := backupCluster.GenerateAndExecuteCommand("Create backup directories on segments", cluster.ON_SEGMENTS, func(contentID int) string {
return fmt.Sprintf("mkdir -p %s", fmt.Sprintf(baseDir, contentID))
})
backupCluster.CheckClusterError(remoteOutput, "Unable to create directories", func(contentID int) string {
return ""
})
for i := 0; i < origSize; i++ {
origDir := fmt.Sprintf(baseDir, i)
destDir := fmt.Sprintf(baseDir, i%segmentCount)
_, err := backupCluster.ExecuteLocalCommand(fmt.Sprintf(`rsync -r -e ssh %s/ %s:%s`, origDir, backupCluster.GetHostForContent(i%segmentCount), destDir))
if err != nil {
Fail(fmt.Sprintf("Could not copy %s to %s: %v", origDir, destDir, err))
}
}
} else {
for i := segmentCount; i < origSize; i++ {
origDir := fmt.Sprintf(baseDir, i)
destDir := fmt.Sprintf(baseDir, i%segmentCount)
files, _ := path.Glob(fmt.Sprintf("%s/*", origDir))
for _, dataFile := range files {
os.Rename(dataFile, fmt.Sprintf("%s/%s", destDir, path.Base(dataFile)))
}
}
}
}
}
}

func TestEndToEnd(t *testing.T) {
format.MaxLength = 0
RegisterFailHandler(Fail)
Expand Down Expand Up @@ -1948,11 +1911,6 @@ LANGUAGE plpgsql NO SQL;`)
defer testhelper.AssertQueryRuns(restoreConn, `DROP SCHEMA IF EXISTS schematwo CASCADE;`)
defer testhelper.AssertQueryRuns(restoreConn, `DROP SCHEMA IF EXISTS schemathree CASCADE;`)

if !testUsesPlugin { // No need to manually move files when using a plugin
isMultiNode := (backupCluster.GetHostForContent(0) != backupCluster.GetHostForContent(-1))
moveSegmentBackupFiles(tarBaseName, extractDirectory, isMultiNode, fullTimestamp, incrementalTimestamp)
}

// This block stops the test if it hangs. It was introduced to prevent hangs causing timeout failures in Concourse CI.
// These hangs are still being observed only in CI, and a definitive RCA has not yet been accomplished
completed := make(chan bool)
Expand Down Expand Up @@ -2097,9 +2055,6 @@ LANGUAGE plpgsql NO SQL;`)
extractDirectory := extractSavedTarFile(backupDir, tarBaseName)
defer testhelper.AssertQueryRuns(restoreConn, `DROP SCHEMA IF EXISTS schemaone CASCADE;`)

isMultiNode := (backupCluster.GetHostForContent(0) != backupCluster.GetHostForContent(-1))
moveSegmentBackupFiles(tarBaseName, extractDirectory, isMultiNode, fullTimestamp)

gprestoreArgs := []string{
"--timestamp", fullTimestamp,
"--redirect-db", "restoredb",
Expand Down

0 comments on commit db55f84

Please sign in to comment.