Skip to content

Commit cac2e66

Browse files
authored
tests: fix flaky workflow search attribute aliasing tests (temporalio#8612)
## What changed? add the `WorkflowID` to the query to isolate tests run in parallel ## Why? Fix flaky tests issue ## How did you test it? - [ ] built - [ ] run locally and tested manually - [X] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks No, test changes only
1 parent 079e85c commit cac2e66

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/workflow_alias_search_attribute_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,26 @@ func (s *WorkflowAliasSearchAttributeTestSuite) TestWorkflowAliasSearchAttribute
8181

8282
s.EventuallyWithT(
8383
func(t *assert.CollectT) {
84+
// Filter by WorkflowId to isolate this test's workflow from other tests
8485
resp, err := s.SdkClient().ListWorkflow(ctx, &workflowservice.ListWorkflowExecutionsRequest{
8586
Namespace: s.Namespace().String(),
87+
Query: fmt.Sprintf("WorkflowId = '%s'", tv.WorkflowID()),
8688
})
8789
require.NoError(t, err)
8890
require.NotNil(t, resp)
8991
require.Len(t, resp.GetExecutions(), 1)
9092

9193
queriedResp, err := s.SdkClient().ListWorkflow(ctx, &workflowservice.ListWorkflowExecutionsRequest{
9294
Namespace: s.Namespace().String(),
93-
Query: fmt.Sprintf("%s = 'Pinned'", searchattribute.TemporalWorkflowVersioningBehavior),
95+
Query: fmt.Sprintf("%s = 'Pinned' AND WorkflowId = '%s'", searchattribute.TemporalWorkflowVersioningBehavior, tv.WorkflowID()),
9496
})
9597
require.NoError(t, err)
9698
require.NotNil(t, resp)
9799
require.Len(t, queriedResp.GetExecutions(), 1)
98100

99101
queriedResp, err = s.SdkClient().ListWorkflow(ctx, &workflowservice.ListWorkflowExecutionsRequest{
100102
Namespace: s.Namespace().String(),
101-
Query: "WorkflowVersioningBehavior = 'Pinned'",
103+
Query: fmt.Sprintf("WorkflowVersioningBehavior = 'Pinned' AND WorkflowId = '%s'", tv.WorkflowID()),
102104
})
103105
require.NoError(t, err)
104106
require.NotNil(t, resp)
@@ -137,17 +139,18 @@ func (s *WorkflowAliasSearchAttributeTestSuite) TestWorkflowAliasSearchAttribute
137139

138140
s.EventuallyWithT(
139141
func(t *assert.CollectT) {
142+
// Filter by WorkflowId to isolate this test's workflow from other tests
140143
queriedResp, err := s.SdkClient().ListWorkflow(ctx, &workflowservice.ListWorkflowExecutionsRequest{
141144
Namespace: s.Namespace().String(),
142-
Query: fmt.Sprintf("%s = 'Pinned'", searchattribute.TemporalWorkflowVersioningBehavior),
145+
Query: fmt.Sprintf("%s = 'Pinned' AND WorkflowId = '%s'", searchattribute.TemporalWorkflowVersioningBehavior, tv.WorkflowID()),
143146
})
144147
require.NoError(t, err)
145148
require.NotNil(t, queriedResp)
146149
require.Len(t, queriedResp.GetExecutions(), 1)
147150

148151
queriedResp, err = s.SdkClient().ListWorkflow(ctx, &workflowservice.ListWorkflowExecutionsRequest{
149152
Namespace: s.Namespace().String(),
150-
Query: "WorkflowVersioningBehavior = 'user-defined'",
153+
Query: fmt.Sprintf("WorkflowVersioningBehavior = 'user-defined' AND WorkflowId = '%s'", tv.WorkflowID()),
151154
})
152155
require.NoError(t, err)
153156
require.NotNil(t, queriedResp)

0 commit comments

Comments
 (0)