diff options
author | Valery Piashchynski <[email protected]> | 2021-07-07 18:33:04 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-07-07 18:33:04 +0300 |
commit | 60c229c8506df465586434309af5acd1f84e2406 (patch) | |
tree | 18fdf380b7e032415d656e84bcc3c7a057f194a8 /plugins/jobs/pipeline/pipeline_test.go | |
parent | 127186a72d4b8d30f6ada72ade661d8713490728 (diff) |
Updated ephemeral plugin, PQ and protobuf...
Implement core of the root jobs plugin with a proper drivers/pipelines
handling mechanism.
Add delayed jobs for the ephemeral plugin.
Remove ResumeAll, Resume, StopAll, Stop. Replaced with Pause/Resume with
a slice of the pipelines.
Other small improvements.
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/pipeline/pipeline_test.go')
-rw-r--r-- | plugins/jobs/pipeline/pipeline_test.go | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/plugins/jobs/pipeline/pipeline_test.go b/plugins/jobs/pipeline/pipeline_test.go index 77acf96e..4482c70d 100644 --- a/plugins/jobs/pipeline/pipeline_test.go +++ b/plugins/jobs/pipeline/pipeline_test.go @@ -2,32 +2,10 @@ package pipeline import ( "testing" - "time" "github.com/stretchr/testify/assert" ) -func TestPipeline_Map(t *testing.T) { - pipe := Pipeline{"options": map[string]interface{}{"ttl": 10}} - - assert.Equal(t, 10, pipe.Map("options").Integer("ttl", 0)) - assert.Equal(t, 0, pipe.Map("other").Integer("ttl", 0)) -} - -func TestPipeline_MapString(t *testing.T) { - pipe := Pipeline{"options": map[string]interface{}{"alias": "default"}} - - assert.Equal(t, "default", pipe.Map("options").String("alias", "")) - assert.Equal(t, "", pipe.Map("other").String("alias", "")) -} - -func TestPipeline_Bool(t *testing.T) { - pipe := Pipeline{"value": true} - - assert.Equal(t, true, pipe.Bool("value", false)) - assert.Equal(t, true, pipe.Bool("other", true)) -} - func TestPipeline_String(t *testing.T) { pipe := Pipeline{"value": "value"} @@ -35,56 +13,9 @@ func TestPipeline_String(t *testing.T) { assert.Equal(t, "value", pipe.String("other", "value")) } -func TestPipeline_Integer(t *testing.T) { - pipe := Pipeline{"value": 1} - - assert.Equal(t, 1, pipe.Integer("value", 0)) - assert.Equal(t, 1, pipe.Integer("other", 1)) -} - -func TestPipeline_Duration(t *testing.T) { - pipe := Pipeline{"value": 1} - - assert.Equal(t, time.Second, pipe.Duration("value", 0)) - assert.Equal(t, time.Second, pipe.Duration("other", time.Second)) -} - func TestPipeline_Has(t *testing.T) { pipe := Pipeline{"options": map[string]interface{}{"ttl": 10}} assert.Equal(t, true, pipe.Has("options")) assert.Equal(t, false, pipe.Has("other")) } - -func TestPipeline_FilterBroker(t *testing.T) { - pipes := Pipelines{ - &Pipeline{"name": "first", "driver": "a"}, - &Pipeline{"name": "second", "driver": "a"}, - &Pipeline{"name": "third", "driver": "b"}, - &Pipeline{"name": "forth", "driver": "b"}, - } - - filtered := pipes.Names("first", "third") - assert.True(t, len(filtered) == 2) - - assert.Equal(t, "a", filtered[0].Driver()) - assert.Equal(t, "b", filtered[1].Driver()) - - filtered = pipes.Names("first", "third").Reverse() - assert.True(t, len(filtered) == 2) - - assert.Equal(t, "a", filtered[1].Driver()) - assert.Equal(t, "b", filtered[0].Driver()) - - filtered = pipes.Broker("a") - assert.True(t, len(filtered) == 2) - - assert.Equal(t, "first", filtered[0].Name()) - assert.Equal(t, "second", filtered[1].Name()) - - filtered = pipes.Broker("a").Reverse() - assert.True(t, len(filtered) == 2) - - assert.Equal(t, "first", filtered[1].Name()) - assert.Equal(t, "second", filtered[0].Name()) -} |