summaryrefslogtreecommitdiff
path: root/internal/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pipeline')
-rw-r--r--internal/pipeline/put_test.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/pipeline/put_test.go b/internal/pipeline/put_test.go
index 68dd173..9cc8b02 100644
--- a/internal/pipeline/put_test.go
+++ b/internal/pipeline/put_test.go
@@ -6,6 +6,7 @@ package pipeline
import (
"errors"
+ "os"
"testing"
)
@@ -16,11 +17,18 @@ func Test_CheckImages(t *testing.T) {
}{
{"testdata/good", nil},
{"testdata/bad", errors.New("Decoding image testdata/bad/bad.png failed: png: invalid format: invalid checksum")},
- {"testdata/nonexistent", nil},
+ {"testdata/notreadable", errors.New("Opening image testdata/notreadable/1.png failed: open testdata/notreadable/1.png: permission denied")},
}
for _, c := range cases {
t.Run(c.dir, func(t *testing.T) {
+ if c.dir == "testdata/notreadable" {
+ err := os.Chmod("testdata/notreadable/1.png", 0000)
+ if err != nil {
+ t.Fatalf("Error preparing test by setting file to be unreadable: %v", err)
+ }
+ }
+
err := CheckImages(c.dir)
if err == nil && c.err != nil {
t.Fatalf("Expected error '%v', got no error", c.err)
@@ -31,6 +39,13 @@ func Test_CheckImages(t *testing.T) {
if err != nil && c.err != nil && err.Error() != c.err.Error() {
t.Fatalf("Got an unexpected error, expected '%v', got '%v'", c.err, err)
}
+
+ if c.dir == "testdata/notreadable" {
+ err := os.Chmod("testdata/notreadable/1.png", 0644)
+ if err != nil {
+ t.Fatalf("Error resetting test by setting file to be readable: %v", err)
+ }
+ }
})
}
}