From ab8565edb45c30fd8387ec3356e5a74ff70c5bad Mon Sep 17 00:00:00 2001 From: Roman Zipp Date: Thu, 20 Jan 2022 17:54:03 +0100 Subject: [PATCH] Add pipeline execution test without any available steps --- pipelines/pipeline_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pipelines/pipeline_test.go b/pipelines/pipeline_test.go index 919f2d6..1619122 100644 --- a/pipelines/pipeline_test.go +++ b/pipelines/pipeline_test.go @@ -65,6 +65,37 @@ func TestVideoPipelineDeserialization(t *testing.T) { // 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) { const Payload string = `{ "name": "example pipeline",