summaryrefslogtreecommitdiff
path: root/tests/plugins/jobs/jobs_amqp_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-18 16:13:49 +0300
committerValery Piashchynski <[email protected]>2021-08-18 16:13:49 +0300
commitc35fbff05205330ab8e49f6008fdbd59128cee14 (patch)
treed3eb03e8db7231d97ae4ff1d60a0c5a50db8a6fb /tests/plugins/jobs/jobs_amqp_test.go
parent1d092e57afb55a01283b41942ca3ef15a7e4bdef (diff)
Add prometheus metrics for the jobs, update tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/jobs/jobs_amqp_test.go')
-rw-r--r--tests/plugins/jobs/jobs_amqp_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/plugins/jobs/jobs_amqp_test.go b/tests/plugins/jobs/jobs_amqp_test.go
index c35244c5..df84fabc 100644
--- a/tests/plugins/jobs/jobs_amqp_test.go
+++ b/tests/plugins/jobs/jobs_amqp_test.go
@@ -134,6 +134,10 @@ func TestAMQPDeclare(t *testing.T) {
mockLogger.EXPECT().Debug("Started RPC service", "address", "tcp://127.0.0.1:6001", "services", gomock.Any()).Times(1)
mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Info("job pushed to the queue", "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Info("job processed without errors", "ID", gomock.Any(), "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Info("job processing started", "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+
mockLogger.EXPECT().Info("pipeline active", "pipeline", "test-3", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Info("pipeline paused", "pipeline", "test-3", "driver", "amqp", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Warn("pipeline stopped", "pipeline", "test-3", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
@@ -229,6 +233,10 @@ func TestAMQPJobsError(t *testing.T) {
mockLogger.EXPECT().Debug("Started RPC service", "address", "tcp://127.0.0.1:6001", "services", gomock.Any()).Times(1)
mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Info("job pushed to the queue", "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Info("job processed without errors", "ID", gomock.Any(), "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Info("job processing started", "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+
mockLogger.EXPECT().Info("pipeline active", "pipeline", "test-3", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Info("pipeline paused", "pipeline", "test-3", "driver", "amqp", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Error("jobs protocol error", "error", "error", "delay", gomock.Any(), "requeue", gomock.Any()).Times(3)
@@ -354,8 +362,11 @@ func TestAMQPStats(t *testing.T) {
mockLogger.EXPECT().Debug("Started RPC service", "address", "tcp://127.0.0.1:6001", "services", gomock.Any()).Times(1)
mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
+ mockLogger.EXPECT().Info("job pushed to the queue", "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
mockLogger.EXPECT().Info("pipeline active", "pipeline", "test-3", "start", gomock.Any(), "elapsed", gomock.Any()).Times(2)
mockLogger.EXPECT().Info("pipeline paused", "pipeline", "test-3", "driver", "amqp", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
+ mockLogger.EXPECT().Info("job processed without errors", "ID", gomock.Any(), "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
+ mockLogger.EXPECT().Info("job processing started", "start", gomock.Any(), "elapsed", gomock.Any()).MinTimes(1)
mockLogger.EXPECT().Warn("pipeline stopped", "pipeline", "test-3", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Info("delivery channel closed, leaving the rabbit listener").AnyTimes()
@@ -437,6 +448,7 @@ func TestAMQPStats(t *testing.T) {
assert.Equal(t, int64(1), out.Active)
assert.Equal(t, int64(1), out.Delayed)
assert.Equal(t, int64(0), out.Reserved)
+ assert.Equal(t, false, out.Ready)
time.Sleep(time.Second)
t.Run("ResumePipeline", resumePipes("test-3"))
@@ -452,6 +464,7 @@ func TestAMQPStats(t *testing.T) {
assert.Equal(t, int64(0), out.Active)
assert.Equal(t, int64(0), out.Delayed)
assert.Equal(t, int64(0), out.Reserved)
+ assert.Equal(t, true, out.Ready)
time.Sleep(time.Second)
t.Run("DestroyAMQPPipeline", destroyPipelines("test-3"))