prepareUploadS3TestFolder creates a temp forlder and the selected number of files in it
(t *testing.T, numFiles int)
| 88 | |
| 89 | // prepareUploadS3TestFolder creates a temp forlder and the selected number of files in it |
| 90 | func prepareUploadS3TestFolder(t *testing.T, numFiles int) (string, []string) { |
| 91 | t.Helper() |
| 92 | |
| 93 | // Create a folder to store files to be uploaded |
| 94 | srcDir := t.TempDir() |
| 95 | |
| 96 | // Write a bunch of files |
| 97 | var fnames []string |
| 98 | for i := 0; i < numFiles; i++ { |
| 99 | fname := filepath.Join(srcDir, fmt.Sprintf("test_file_%d", i)) |
| 100 | |
| 101 | if err := os.WriteFile(fname, []byte("abc"), 0644); err != nil { |
| 102 | t.Fatalf("can't create temp file: %v", err) |
| 103 | } |
| 104 | |
| 105 | fnames = append(fnames, fname) |
| 106 | } |
| 107 | |
| 108 | return srcDir, fnames |
| 109 | } |
| 110 | |
| 111 | func TestS3Upload(t *testing.T) { |
| 112 | // Through the use of a mocked S3 service, this test verifies that sending |
no outgoing calls
no test coverage detected