Skip to content

Commit c9fb972

Browse files
committed
Fix failing notify test.
1 parent 6b84432 commit c9fb972

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

notify_test.go

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"github.com/google/uuid"
55
"github.com/stretchr/testify/assert"
66
"testing"
7-
"time"
87
workflow "workflow-go"
98
)
109

@@ -26,9 +25,9 @@ func TestNotify(t *testing.T) {
2625
})
2726

2827
eventId := uuid.NewString()
29-
expectedEventData := jsonMarshall(t, map[string]string{
28+
expectedEventData := map[string]string{
3029
"uuid": uuid.NewString(),
31-
})
30+
}
3231
runId, err := client.Trigger(workflow.TriggerOptions{
3332
Url: waitForEvent,
3433
Body: jsonMarshall(t, map[string]any{
@@ -39,30 +38,9 @@ func TestNotify(t *testing.T) {
3938
assert.NoError(t, err)
4039
assert.NotEmpty(t, runId)
4140

42-
assert.Eventually(t, func() bool {
43-
subT := &testing.T{}
44-
45-
runs, cursor, err := client.Logs(workflow.LogsOptions{
46-
Filter: workflow.LogFilter{
47-
RunId: runId,
48-
},
49-
})
50-
assert.NoError(subT, err)
51-
assert.Empty(subT, cursor)
52-
if len(runs) != 1 {
53-
return false
54-
}
55-
run := runs[0]
56-
assert.Len(subT, run.GroupedSteps, 3)
57-
if len(run.GroupedSteps[len(run.GroupedSteps)-1].Steps) != 1 {
58-
return false
59-
}
60-
lastStep := run.GroupedSteps[len(run.GroupedSteps)-1].Steps[0]
61-
assert.Equal(subT, lastStep.StepType, "Wait")
62-
return !subT.Failed()
63-
}, time.Minute, time.Millisecond*100)
41+
waitUntilWaitStep(t, client, runId)
6442

65-
messages, err := client.Notify(eventId, expectedEventData)
43+
messages, err := client.Notify(eventId, jsonMarshall(t, expectedEventData))
6644
assert.NoError(t, err)
6745
assert.Len(t, messages, 1)
6846

0 commit comments

Comments
 (0)