@@ -111,24 +111,26 @@ func (s *workflowStateStatusSuite) TestCreateWorkflowStateStatus_WorkflowStateZo
111111}
112112
113113func (s * workflowStateStatusSuite ) TestUpdateWorkflowStateStatus_WorkflowStateCreated () {
114- statuses := []enumspb.WorkflowExecutionStatus {
114+ disallowedStatuses := []enumspb.WorkflowExecutionStatus {
115115 enumspb .WORKFLOW_EXECUTION_STATUS_COMPLETED ,
116116 enumspb .WORKFLOW_EXECUTION_STATUS_FAILED ,
117117 enumspb .WORKFLOW_EXECUTION_STATUS_CANCELED ,
118118 enumspb .WORKFLOW_EXECUTION_STATUS_TERMINATED ,
119119 enumspb .WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW ,
120120 enumspb .WORKFLOW_EXECUTION_STATUS_TIMED_OUT ,
121+ enumspb .WORKFLOW_EXECUTION_STATUS_PAUSED ,
121122 }
122123
124+ // Updating workflow to State: CREATED and status: RUNNING is allowed
123125 s .NoError (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_CREATED , enumspb .WORKFLOW_EXECUTION_STATUS_RUNNING ))
124126
125- for _ , status := range statuses {
127+ for _ , status := range disallowedStatuses {
126128 s .Error (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_CREATED , status ))
127129 }
128130}
129131
130132func (s * workflowStateStatusSuite ) TestUpdateWorkflowStateStatus_WorkflowStateRunning () {
131- statuses := []enumspb.WorkflowExecutionStatus {
133+ disallowedStatuses := []enumspb.WorkflowExecutionStatus {
132134 enumspb .WORKFLOW_EXECUTION_STATUS_COMPLETED ,
133135 enumspb .WORKFLOW_EXECUTION_STATUS_FAILED ,
134136 enumspb .WORKFLOW_EXECUTION_STATUS_CANCELED ,
@@ -137,15 +139,17 @@ func (s *workflowStateStatusSuite) TestUpdateWorkflowStateStatus_WorkflowStateRu
137139 enumspb .WORKFLOW_EXECUTION_STATUS_TIMED_OUT ,
138140 }
139141
142+ // Updating workflow to State: RUNNING and status: {RUNNING, PAUSED} is allowed
140143 s .NoError (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_RUNNING , enumspb .WORKFLOW_EXECUTION_STATUS_RUNNING ))
144+ s .NoError (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_RUNNING , enumspb .WORKFLOW_EXECUTION_STATUS_PAUSED ))
141145
142- for _ , status := range statuses {
146+ for _ , status := range disallowedStatuses {
143147 s .Error (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_RUNNING , status ))
144148 }
145149}
146150
147151func (s * workflowStateStatusSuite ) TestUpdateWorkflowStateStatus_WorkflowStateCompleted () {
148- statuses := []enumspb.WorkflowExecutionStatus {
152+ allowedStatuses := []enumspb.WorkflowExecutionStatus {
149153 enumspb .WORKFLOW_EXECUTION_STATUS_COMPLETED ,
150154 enumspb .WORKFLOW_EXECUTION_STATUS_FAILED ,
151155 enumspb .WORKFLOW_EXECUTION_STATUS_CANCELED ,
@@ -154,15 +158,17 @@ func (s *workflowStateStatusSuite) TestUpdateWorkflowStateStatus_WorkflowStateCo
154158 enumspb .WORKFLOW_EXECUTION_STATUS_TIMED_OUT ,
155159 }
156160
161+ // Updating workflow to State: COMPLETED and status: {RUNNING, PAUSED} is *not* allowed
157162 s .Error (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_COMPLETED , enumspb .WORKFLOW_EXECUTION_STATUS_RUNNING ))
163+ s .Error (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_COMPLETED , enumspb .WORKFLOW_EXECUTION_STATUS_PAUSED ))
158164
159- for _ , status := range statuses {
165+ for _ , status := range allowedStatuses {
160166 s .NoError (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_COMPLETED , status ))
161167 }
162168}
163169
164170func (s * workflowStateStatusSuite ) TestUpdateWorkflowStateStatus_WorkflowStateZombie () {
165- statuses := []enumspb.WorkflowExecutionStatus {
171+ disallowedStatuses := []enumspb.WorkflowExecutionStatus {
166172 enumspb .WORKFLOW_EXECUTION_STATUS_COMPLETED ,
167173 enumspb .WORKFLOW_EXECUTION_STATUS_FAILED ,
168174 enumspb .WORKFLOW_EXECUTION_STATUS_CANCELED ,
@@ -171,9 +177,11 @@ func (s *workflowStateStatusSuite) TestUpdateWorkflowStateStatus_WorkflowStateZo
171177 enumspb .WORKFLOW_EXECUTION_STATUS_TIMED_OUT ,
172178 }
173179
180+ // Updating workflow to State: ZOMBIE and status: {RUNNING, PAUSED} is allowed
174181 s .NoError (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_ZOMBIE , enumspb .WORKFLOW_EXECUTION_STATUS_RUNNING ))
182+ s .NoError (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_ZOMBIE , enumspb .WORKFLOW_EXECUTION_STATUS_PAUSED ))
175183
176- for _ , status := range statuses {
184+ for _ , status := range disallowedStatuses {
177185 s .Error (ValidateUpdateWorkflowStateStatus (enumsspb .WORKFLOW_EXECUTION_STATE_ZOMBIE , status ))
178186 }
179187}
0 commit comments