summaryrefslogtreecommitdiff
path: root/tests/plugins/jobs/jobs_plugin_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-22 19:41:11 +0300
committerValery Piashchynski <[email protected]>2021-07-22 19:41:11 +0300
commit584e9ad1f50223f873661babae3b365a2b0662ec (patch)
tree16c0b10b57f6703e56f6c84d7d81ae43f554bbf4 /tests/plugins/jobs/jobs_plugin_test.go
parent2ceebd687fd17b6029ef3df0e979c39bb39abc7f (diff)
Initial tests for all drivers
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/jobs/jobs_plugin_test.go')
-rw-r--r--tests/plugins/jobs/jobs_plugin_test.go92
1 files changed, 4 insertions, 88 deletions
diff --git a/tests/plugins/jobs/jobs_plugin_test.go b/tests/plugins/jobs/jobs_plugin_test.go
index 0f9c2bb1..54015f03 100644
--- a/tests/plugins/jobs/jobs_plugin_test.go
+++ b/tests/plugins/jobs/jobs_plugin_test.go
@@ -69,7 +69,8 @@ func TestJobsInit(t *testing.T) {
cfg,
&server.Plugin{},
&rpcPlugin.Plugin{},
- mockLogger,
+ &logger.ZapLogger{},
+ // mockLogger,
&jobs.Plugin{},
&resetter.Plugin{},
&informer.Plugin{},
@@ -194,7 +195,8 @@ func TestJobsPauseResume(t *testing.T) {
cfg,
&server.Plugin{},
&rpcPlugin.Plugin{},
- mockLogger,
+ &logger.ZapLogger{},
+ // mockLogger,
&jobs.Plugin{},
&resetter.Plugin{},
&informer.Plugin{},
@@ -286,89 +288,3 @@ func ephemeralResume(t *testing.T) {
err = client.Call("jobs.Resume", pipe, er)
assert.NoError(t, err)
}
-
-func pushToDisabledPipe(pipeline 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))
-
- req := &jobsv1beta.PushRequest{Job: &jobsv1beta.Job{
- Job: "some/php/namespace",
- Id: "1",
- Payload: `{"hello":"world"}`,
- Headers: nil,
- Options: &jobsv1beta.Options{
- Priority: 1,
- Pipeline: pipeline,
- },
- }}
-
- er := &jobsv1beta.Empty{}
- err = client.Call("jobs.Push", req, er)
- assert.Error(t, err)
- }
-}
-
-func pushToPipe(pipeline 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))
-
- req := &jobsv1beta.PushRequest{Job: &jobsv1beta.Job{
- Job: "some/php/namespace",
- Id: "1",
- Payload: `{"hello":"world"}`,
- Headers: map[string]*jobsv1beta.HeaderValue{"test": {Value: []string{"test2"}}},
- Options: &jobsv1beta.Options{
- Priority: 1,
- Pipeline: pipeline,
- Delay: 0,
- Attempts: 0,
- RetryDelay: 0,
- Timeout: 0,
- },
- }}
-
- er := &jobsv1beta.Empty{}
- err = client.Call("jobs.Push", req, er)
- 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)
- }
-}