Skip to content

Commit

Permalink
write test for downloading multiple versions of multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
sauterp committed Sep 22, 2023
1 parent 194d508 commit f7ceb3c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
58 changes: 58 additions & 0 deletions internal/acctests/sos/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,61 @@ func (s *SOSSuite) TestDownloadMultipleObjects() {
},
})
}

func (s *SOSSuite) TestDownloadMultipleVersionedObjects() {
s.Execute(SOSTest{
Steps: []Step{
{
Description: "check that multiple files can be uploaded and downloaded from versioned bucket",
PreparedFiles: LocalFiles{
"file1.txt": "original content 1",
"file2.txt": "original content 2",
},
Commands: []string{
"exo storage bucket versioning enable {bucket}",
"exo storage upload {prepDir}file1.txt {bucket}",
"exo storage upload {prepDir}file2.txt {bucket}",
"exo storage download -r {bucket} {downloadDir}",
},
ExpectedDownloadFiles: LocalFiles{
"file1.txt": "original content 1",
"file2.txt": "original content 2",
},
},
{
Description: "check that the latest version is downloaded from versioned bucket",
PreparedFiles: LocalFiles{
"file1.txt": "new content 1",
"file2.txt": "new content 2",
},
Commands: []string{
"exo storage upload {prepDir}file1.txt {bucket}",
"exo storage upload {prepDir}file2.txt {bucket}",
"exo storage download -r {bucket} {downloadDir}",
},
ClearDownloadDirBeforeCommands: true,
ExpectedDownloadFiles: LocalFiles{
"file1.txt": "new content 1",
"file2.txt": "new content 2",
},
},
{
Description: "download all versions of multiple files",
PreparedFiles: LocalFiles{
"file1.txt": "newer content 1",
"file2.txt": "newer content 2",
},
Commands: []string{
"exo storage upload {prepDir}file1.txt {bucket}",
"exo storage upload {prepDir}file2.txt {bucket}",
"exo storage download --versions -r {bucket} {downloadDir}",
},
ClearDownloadDirBeforeCommands: true,
ExpectedDownloadFiles: LocalFiles{
"file1.txt": "new content 1",
"file2.txt": "new content 2",
},
},
},
})
}
1 change: 0 additions & 1 deletion internal/acctests/sos/sos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func (s *SOSSuite) Execute(test SOSTest) {
err := filepath.WalkDir(s.DownloadDir, registerFile(s, downloadDir, s.DownloadDir))
s.NoError(err)
nFiles := len(downloadDir)
fmt.Printf("downloadDir: %v\n", downloadDir)

actualFileNumberMismatches := !s.Equal(len(step.ExpectedDownloadFiles), nFiles, "number of actual files doesn't match number of expected files")
if actualFileNumberMismatches {
Expand Down

0 comments on commit f7ceb3c

Please sign in to comment.