|
@ -65,6 +65,37 @@ func TestVideoPipelineDeserialization(t *testing.T) { |
|
|
|
|
|
|
|
|
// image pipeline steps
|
|
|
// image pipeline steps
|
|
|
|
|
|
|
|
|
|
|
|
func TestNoSteps(t *testing.T) { |
|
|
|
|
|
const Payload string = `{ |
|
|
|
|
|
"name": "example pipeline", |
|
|
|
|
|
"type": 1, |
|
|
|
|
|
"removeMetadata": false, |
|
|
|
|
|
"steps": [] |
|
|
|
|
|
}` |
|
|
|
|
|
const Bucket string = "pipeline_test_04" |
|
|
|
|
|
|
|
|
|
|
|
t.Run("Pipeline execution is successful", func(t *testing.T) { |
|
|
|
|
|
wd, _ := os.Getwd() |
|
|
|
|
|
pipe := DeserializePipelines([][]byte{[]byte(Payload)})[0] |
|
|
|
|
|
|
|
|
|
|
|
storageProvider := storage.GetFileSystemStorageProvider("test", "..") |
|
|
|
|
|
|
|
|
|
|
|
// copy test file to storage bucket
|
|
|
|
|
|
_, err := storageProvider.StoreExisting(Bucket, "source.jpg", filepath.Join(wd, "../tests/files/900x900.jpg")) |
|
|
|
|
|
assert.Nil(t, err, "Test file should be readable") |
|
|
|
|
|
assert.FileExists(t, storageProvider.GetPath(Bucket, "source.jpg")) |
|
|
|
|
|
|
|
|
|
|
|
// run pipeline steps
|
|
|
|
|
|
dest, err := pipe.Run("source.jpg", Bucket, storageProvider) |
|
|
|
|
|
assert.Nil(t, err) |
|
|
|
|
|
assert.FileExists(t, storageProvider.GetPath(Bucket, dest)) |
|
|
|
|
|
|
|
|
|
|
|
// clean up
|
|
|
|
|
|
os.Remove(storageProvider.GetPath(Bucket, "source.jpg")) |
|
|
|
|
|
os.Remove(storageProvider.GetPath(Bucket, dest)) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func TestResizeImage(t *testing.T) { |
|
|
func TestResizeImage(t *testing.T) { |
|
|
const Payload string = `{ |
|
|
const Payload string = `{ |
|
|
"name": "example pipeline", |
|
|
"name": "example pipeline", |
|
|