Skip to content

Commit

Permalink
feat(worker): Added worker pool health check probe
Browse files Browse the repository at this point in the history
  • Loading branch information
ekkinox committed Jul 17, 2024
1 parent f8c3b81 commit 8a4b4fc
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions worker/healthcheck/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ import (
func TestWorkerProbe(t *testing.T) {
t.Parallel()

t.Run("empty pool", func(t *testing.T) {
t.Run("custom name", func(t *testing.T) {
t.Parallel()

pool := worker.NewWorkerPool()
probe := healthcheck.NewWorkerProbe(&worker.WorkerPool{})

probe.SetName("foo")

assert.Equal(t, "foo", probe.Name())
})

t.Run("check empty pool", func(t *testing.T) {
t.Parallel()

pool, err := worker.NewDefaultWorkerPoolFactory().Create(
worker.WithWorker(workers.NewClassicWorker()),
)
assert.NoError(t, err)

probe := healthcheck.NewWorkerProbe(pool)

Expand All @@ -27,7 +40,7 @@ func TestWorkerProbe(t *testing.T) {
assert.Empty(t, res.Message)
})

t.Run("success pool", func(t *testing.T) {
t.Run("check success pool", func(t *testing.T) {
t.Parallel()

pool, err := worker.NewDefaultWorkerPoolFactory().Create(
Expand All @@ -48,7 +61,7 @@ func TestWorkerProbe(t *testing.T) {
assert.Equal(t, "ClassicWorker: success", res.Message)
})

t.Run("error pool", func(t *testing.T) {
t.Run("check error pool", func(t *testing.T) {
t.Parallel()

pool, err := worker.NewDefaultWorkerPoolFactory().Create(
Expand Down

0 comments on commit 8a4b4fc

Please sign in to comment.