Browse Source

Add pipeline execution test without any available steps

feature/update-route-registration
Roman Zipp 3 years ago
committed by Fabian Vowie
parent
commit
ab8565edb4
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 31
      pipelines/pipeline_test.go

31
pipelines/pipeline_test.go

@ -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",

Loading…
Cancel
Save