Skip to content

Commit

Permalink
fix task queue tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigozhou committed Oct 30, 2024
1 parent 9e9cde2 commit 7d57555
Showing 1 changed file with 69 additions and 47 deletions.
116 changes: 69 additions & 47 deletions temporalcli/commands.taskqueue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package temporalcli_test

import (
"encoding/json"
"github.com/stretchr/testify/assert"
"go.temporal.io/sdk/workflow"
"strings"
"time"

"github.com/google/uuid"
"github.com/stretchr/testify/assert"
"github.com/temporalio/cli/temporalcli"
"go.temporal.io/api/enums/v1"
"go.temporal.io/api/workflowservice/v1"
"go.temporal.io/sdk/workflow"
)

type statsRowType struct {
Expand Down Expand Up @@ -261,58 +261,80 @@ func (s *SharedServerSuite) TestTaskQueue_Describe_Simple() {
)
s.NoError(res.Err)

// Text
res = s.Execute(
"task-queue", "describe",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
s.EventuallyWithT(
func(t *assert.CollectT) {
// Text
res := s.Execute(
"task-queue", "describe",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
)
assert.NoError(t, res.Err)
assert.NoError(t, AssertContainsOnSameLine(res.Stdout.String(), "id1", "reachable"))
// No pollers on id1
assert.NotContains(t, res.Stdout.String(), "now")
},
5*time.Second,
1*time.Second,
)
s.NoError(res.Err)

s.ContainsOnSameLine(res.Stdout.String(), "id1", "reachable")
// No pollers on id1
s.NotContains(res.Stdout.String(), "now")

res = s.Execute(
"task-queue", "describe",
"--select-unversioned",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
s.EventuallyWithT(
func(t *assert.CollectT) {
res := s.Execute(
"task-queue", "describe",
"--select-unversioned",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
)
assert.NoError(t, res.Err)

assert.NoError(t, AssertContainsOnSameLine(res.Stdout.String(), "UNVERSIONED", "unreachable"))
assert.NoError(t, AssertContainsOnSameLine(res.Stdout.String(), "UNVERSIONED", "workflow", s.DevServer.Options.ClientOptions.Identity, "100000"))
assert.NoError(t, AssertContainsOnSameLine(res.Stdout.String(), "UNVERSIONED", "activity", s.DevServer.Options.ClientOptions.Identity, "100000"))
},
5*time.Second,
1*time.Second,
)
s.NoError(res.Err)

s.ContainsOnSameLine(res.Stdout.String(), "UNVERSIONED", "unreachable")
s.ContainsOnSameLine(res.Stdout.String(), "UNVERSIONED", "workflow", s.DevServer.Options.ClientOptions.Identity, "now", "100000")
s.ContainsOnSameLine(res.Stdout.String(), "UNVERSIONED", "activity", s.DevServer.Options.ClientOptions.Identity, "now", "100000")

res = s.Execute(
"task-queue", "describe",
"--select-build-id", "id2",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
s.EventuallyWithT(
func(t *assert.CollectT) {
res := s.Execute(
"task-queue", "describe",
"--select-build-id", "id2",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
)
assert.NoError(t, res.Err)
assert.NoError(t, AssertContainsOnSameLine(res.Stdout.String(), "id2", "unreachable"))
// No pollers on id2
assert.NotContains(t, res.Stdout.String(), "now")
},
5*time.Second,
1*time.Second,
)
s.NoError(res.Err)

s.ContainsOnSameLine(res.Stdout.String(), "id2", "unreachable")
// No pollers on id2
s.NotContains(res.Stdout.String(), "now")

res = s.Execute(
"task-queue", "describe",
"--select-all-active",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
s.EventuallyWithT(
func(t *assert.CollectT) {
res := s.Execute(
"task-queue", "describe",
"--select-all-active",
"--address", s.Address(),
"--report-reachability",
"--disable-stats",
"--task-queue", s.Worker().Options.TaskQueue,
)
assert.NoError(t, res.Err)
assert.NotContains(t, res.Stdout.String(), "now")
},
5*time.Second,
1*time.Second,
)
s.NoError(res.Err)
s.NotContains(res.Stdout.String(), "now")
}

func (s *SharedServerSuite) TestTaskQueue_Describe_Simple_Legacy() {
Expand Down

0 comments on commit 7d57555

Please sign in to comment.