summaryrefslogtreecommitdiff
path: root/tests/plugins/jobs/jobs_plugin_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/jobs/jobs_plugin_test.go')
-rw-r--r--tests/plugins/jobs/jobs_plugin_test.go50
1 files changed, 45 insertions, 5 deletions
diff --git a/tests/plugins/jobs/jobs_plugin_test.go b/tests/plugins/jobs/jobs_plugin_test.go
index c10ac350..0f9c2bb1 100644
--- a/tests/plugins/jobs/jobs_plugin_test.go
+++ b/tests/plugins/jobs/jobs_plugin_test.go
@@ -266,7 +266,7 @@ func ephemeralPause(t *testing.T) {
assert.NoError(t, err)
client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))
- pipe := &jobsv1beta.Maintenance{Pipelines: make([]string, 1)}
+ pipe := &jobsv1beta.Pipelines{Pipelines: make([]string, 1)}
pipe.GetPipelines()[0] = "test-local"
er := &jobsv1beta.Empty{}
@@ -279,7 +279,7 @@ func ephemeralResume(t *testing.T) {
assert.NoError(t, err)
client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))
- pipe := &jobsv1beta.Maintenance{Pipelines: make([]string, 1)}
+ pipe := &jobsv1beta.Pipelines{Pipelines: make([]string, 1)}
pipe.GetPipelines()[0] = "test-local"
er := &jobsv1beta.Empty{}
@@ -320,10 +320,14 @@ func pushToPipe(pipeline string) func(t *testing.T) {
Job: "some/php/namespace",
Id: "1",
Payload: `{"hello":"world"}`,
- Headers: nil,
+ Headers: map[string]*jobsv1beta.HeaderValue{"test": {Value: []string{"test2"}}},
Options: &jobsv1beta.Options{
- Priority: 1,
- Pipeline: pipeline,
+ Priority: 1,
+ Pipeline: pipeline,
+ Delay: 0,
+ Attempts: 0,
+ RetryDelay: 0,
+ Timeout: 0,
},
}}
@@ -332,3 +336,39 @@ func pushToPipe(pipeline string) func(t *testing.T) {
assert.NoError(t, err)
}
}
+
+func pausePipelines(pipes ...string) func(t *testing.T) {
+ return func(t *testing.T) {
+ conn, err := net.Dial("tcp", "127.0.0.1:6001")
+ assert.NoError(t, err)
+ client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))
+
+ pipe := &jobsv1beta.Pipelines{Pipelines: make([]string, len(pipes))}
+
+ for i := 0; i < len(pipes); i++ {
+ pipe.GetPipelines()[i] = pipes[i]
+ }
+
+ er := &jobsv1beta.Empty{}
+ err = client.Call("jobs.Pause", pipe, er)
+ assert.NoError(t, err)
+ }
+}
+
+func destroyPipelines(pipes ...string) func(t *testing.T) {
+ return func(t *testing.T) {
+ conn, err := net.Dial("tcp", "127.0.0.1:6001")
+ assert.NoError(t, err)
+ client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))
+
+ pipe := &jobsv1beta.Pipelines{Pipelines: make([]string, len(pipes))}
+
+ for i := 0; i < len(pipes); i++ {
+ pipe.GetPipelines()[i] = pipes[i]
+ }
+
+ er := &jobsv1beta.Empty{}
+ err = client.Call("jobs.Destroy", pipe, er)
+ assert.NoError(t, err)
+ }
+}