summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorNick White <git@njw.name>2021-08-17 13:18:04 +0100
committerNick White <git@njw.name>2021-08-17 13:18:04 +0100
commit48c68cfa7f18992b26765c7b67c52c11687ad74a (patch)
tree6194e21f03f381e1886534ca2ffd3830591bb461 /internal
parent2bac685f600b97676de14bb850e5b087f0d54b83 (diff)
pipeline: use regular storage for tests, rather than a separate one
Diffstat (limited to 'internal')
-rw-r--r--internal/pipeline/put.go6
-rw-r--r--internal/pipeline/put_test.go7
2 files changed, 4 insertions, 9 deletions
diff --git a/internal/pipeline/put.go b/internal/pipeline/put.go
index 26d581c..8cbecac 100644
--- a/internal/pipeline/put.go
+++ b/internal/pipeline/put.go
@@ -78,9 +78,9 @@ func DetectQueueType(dir string, conn Queuer) string {
}
// UploadImages uploads all files (except those which start with a ".")
-// from a directory (recursively) into a given storage id, prefixed with
+// from a directory (recursively) into conn.WIPStorageId(), prefixed with
// the given bookname and a slash
-func UploadImages(dir string, bookname string, conn Uploader, storageId string) error {
+func UploadImages(dir string, bookname string, conn Uploader) error {
walker := make(fileWalk)
go func() {
_ = filepath.Walk(dir, walker.Walk)
@@ -89,7 +89,7 @@ func UploadImages(dir string, bookname string, conn Uploader, storageId string)
for path := range walker {
name := filepath.Base(path)
- err := conn.Upload(storageId, bookname + "/" + name, path)
+ err := conn.Upload(conn.WIPStorageId(), bookname + "/" + name, path)
if err != nil {
return fmt.Errorf("Failed to upload %s: %v", path, err)
}
diff --git a/internal/pipeline/put_test.go b/internal/pipeline/put_test.go
index 912a4ef..5fb5b43 100644
--- a/internal/pipeline/put_test.go
+++ b/internal/pipeline/put_test.go
@@ -92,18 +92,13 @@ func Test_UploadImages(t *testing.T) {
if err != nil {
t.Fatalf("Could not initialise %s connection: %v\nLog: %s", conn.name, err, slog.log)
}
- err = conn.c.TestInit()
- if err != nil {
- t.Fatalf("Failed in test initialisalisation for %s: %v\nLog: %s", conn.name, err, slog.log)
- }
slog.log = ""
- err = UploadImages("testdata/good", "good", conn.c, conn.c.TestStorageId())
+ err = UploadImages("testdata/good", "good", conn.c)
if err != nil {
t.Fatalf("Error in UploadImages for %s: %v\nLog: %s", conn.name, err, slog.log)
}
- // TODO: decide on whether to use TestStorageId or just the WIPStorageId as with other tests, and align other tests to this if needed
// TODO: download all files and test that they match
// TODO: remove test files from conn storage
})