summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-27 12:39:01 +0300
committerValery Piashchynski <[email protected]>2021-07-27 12:39:01 +0300
commit1e59ec2755a9cdafd26864ba532fa4d3eff46ecd (patch)
tree68c7c7e8d9f4d99debc4895ab8469e323c60f47b /tests
parentd72181126867c7e8fc05e5ac927bd90d01e0dbc7 (diff)
Initial support for the cancellation via context
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/env/Dockerfile-beanstalkd.yaml4
-rw-r--r--tests/plugins/jobs/amqp/.rr-amqp-init.yaml3
-rw-r--r--tests/plugins/jobs/durability/.rr-amqp-durability-redial.yaml3
-rw-r--r--tests/plugins/jobs/helpers.go26
-rw-r--r--tests/plugins/jobs/jobs_with_toxics_test.go12
5 files changed, 39 insertions, 9 deletions
diff --git a/tests/env/Dockerfile-beanstalkd.yaml b/tests/env/Dockerfile-beanstalkd.yaml
index cb81aafa..7b36f8d3 100644
--- a/tests/env/Dockerfile-beanstalkd.yaml
+++ b/tests/env/Dockerfile-beanstalkd.yaml
@@ -1,6 +1,8 @@
FROM ubuntu:latest
-RUN apt-get update && apt-get install -y curl build-essential
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update && apt-get install -y curl build-essential pkg-config
RUN curl -sL https://github.com/kr/beanstalkd/archive/v1.12.tar.gz | tar xvz -C /tmp
diff --git a/tests/plugins/jobs/amqp/.rr-amqp-init.yaml b/tests/plugins/jobs/amqp/.rr-amqp-init.yaml
index 44e12d89..5c585372 100644
--- a/tests/plugins/jobs/amqp/.rr-amqp-init.yaml
+++ b/tests/plugins/jobs/amqp/.rr-amqp-init.yaml
@@ -10,13 +10,14 @@ amqp:
addr: amqp://guest:guest@localhost:5672/
logs:
- level: info
+ level: debug
encoding: console
mode: development
jobs:
num_pollers: 10
pipeline_size: 100000
+ timeout: 1
pool:
num_workers: 10
max_jobs: 0
diff --git a/tests/plugins/jobs/durability/.rr-amqp-durability-redial.yaml b/tests/plugins/jobs/durability/.rr-amqp-durability-redial.yaml
index e530dbcd..a66e1979 100644
--- a/tests/plugins/jobs/durability/.rr-amqp-durability-redial.yaml
+++ b/tests/plugins/jobs/durability/.rr-amqp-durability-redial.yaml
@@ -10,13 +10,14 @@ amqp:
addr: amqp://guest:guest@localhost:23679/
logs:
- level: info
+ level: debug
encoding: console
mode: development
jobs:
num_pollers: 10
pipeline_size: 100000
+ timeout: 1
pool:
num_workers: 10
max_jobs: 0
diff --git a/tests/plugins/jobs/helpers.go b/tests/plugins/jobs/helpers.go
index b5100df5..0d7d6ac6 100644
--- a/tests/plugins/jobs/helpers.go
+++ b/tests/plugins/jobs/helpers.go
@@ -88,6 +88,32 @@ func pushToPipe(pipeline string) func(t *testing.T) {
}
}
+func pushToPipeErr(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(push, req, er)
+ require.Error(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")
diff --git a/tests/plugins/jobs/jobs_with_toxics_test.go b/tests/plugins/jobs/jobs_with_toxics_test.go
index 85fd4fa8..7e2bd8be 100644
--- a/tests/plugins/jobs/jobs_with_toxics_test.go
+++ b/tests/plugins/jobs/jobs_with_toxics_test.go
@@ -132,18 +132,18 @@ func TestDurabilityAMQP(t *testing.T) {
time.Sleep(time.Second * 3)
go func() {
- time.Sleep(time.Second * 2)
- t.Run("PushPipelineWhileRedialing-1", pushToPipe("test-1"))
- t.Run("PushPipelineWhileRedialing-2", pushToPipe("test-2"))
+ time.Sleep(time.Second * 5)
+ enableProxy("redial", t)
}()
- time.Sleep(time.Second * 5)
- enableProxy("redial", t)
+ t.Run("PushPipelineWhileRedialing-1", pushToPipeErr("test-1"))
+ t.Run("PushPipelineWhileRedialing-2", pushToPipeErr("test-2"))
+ time.Sleep(time.Second * 15)
t.Run("PushPipelineWhileRedialing-1", pushToPipe("test-1"))
t.Run("PushPipelineWhileRedialing-2", pushToPipe("test-2"))
- time.Sleep(time.Second * 10)
+ time.Sleep(time.Second * 5)
stopCh <- struct{}{}
wg.Wait()