go.uber.org/cadence@v1.2.9/internal/compatibility/enum_test.go (about)

     1  // Copyright (c) 2021 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package compatibility
    22  
    23  import (
    24  	"testing"
    25  
    26  	"github.com/stretchr/testify/assert"
    27  	apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
    28  
    29  	"go.uber.org/cadence/.gen/go/shared"
    30  	"go.uber.org/cadence/internal/compatibility/proto"
    31  	"go.uber.org/cadence/internal/compatibility/thrift"
    32  )
    33  
    34  const UnknownValue = 9999
    35  
    36  func TestArchivalStatus(t *testing.T) {
    37  	for _, item := range []apiv1.ArchivalStatus{
    38  		apiv1.ArchivalStatus_ARCHIVAL_STATUS_INVALID,
    39  		apiv1.ArchivalStatus_ARCHIVAL_STATUS_DISABLED,
    40  		apiv1.ArchivalStatus_ARCHIVAL_STATUS_ENABLED,
    41  	} {
    42  		assert.Equal(t, item, proto.ArchivalStatus(thrift.ArchivalStatus(item)))
    43  	}
    44  	assert.Panics(t, func() { proto.ArchivalStatus(shared.ArchivalStatus(UnknownValue).Ptr()) })
    45  	assert.Panics(t, func() { thrift.ArchivalStatus(apiv1.ArchivalStatus(UnknownValue)) })
    46  }
    47  func TestCancelExternalWorkflowExecutionFailedCause(t *testing.T) {
    48  	for _, item := range []apiv1.CancelExternalWorkflowExecutionFailedCause{
    49  		apiv1.CancelExternalWorkflowExecutionFailedCause_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID,
    50  		apiv1.CancelExternalWorkflowExecutionFailedCause_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,
    51  	} {
    52  		assert.Equal(t, item, proto.CancelExternalWorkflowExecutionFailedCause(thrift.CancelExternalWorkflowExecutionFailedCause(item)))
    53  	}
    54  	assert.Panics(t, func() {
    55  		proto.CancelExternalWorkflowExecutionFailedCause(shared.CancelExternalWorkflowExecutionFailedCause(UnknownValue).Ptr())
    56  	})
    57  	assert.Panics(t, func() {
    58  		thrift.CancelExternalWorkflowExecutionFailedCause(apiv1.CancelExternalWorkflowExecutionFailedCause(UnknownValue))
    59  	})
    60  }
    61  func TestChildWorkflowExecutionFailedCause(t *testing.T) {
    62  	for _, item := range []apiv1.ChildWorkflowExecutionFailedCause{
    63  		apiv1.ChildWorkflowExecutionFailedCause_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID,
    64  		apiv1.ChildWorkflowExecutionFailedCause_CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_RUNNING,
    65  	} {
    66  		assert.Equal(t, item, proto.ChildWorkflowExecutionFailedCause(thrift.ChildWorkflowExecutionFailedCause(item)))
    67  	}
    68  	assert.Panics(t, func() {
    69  		proto.ChildWorkflowExecutionFailedCause(shared.ChildWorkflowExecutionFailedCause(UnknownValue).Ptr())
    70  	})
    71  	assert.Panics(t, func() {
    72  		thrift.ChildWorkflowExecutionFailedCause(apiv1.ChildWorkflowExecutionFailedCause(UnknownValue))
    73  	})
    74  }
    75  func TestContinueAsNewInitiator(t *testing.T) {
    76  	for _, item := range []apiv1.ContinueAsNewInitiator{
    77  		apiv1.ContinueAsNewInitiator_CONTINUE_AS_NEW_INITIATOR_INVALID,
    78  		apiv1.ContinueAsNewInitiator_CONTINUE_AS_NEW_INITIATOR_DECIDER,
    79  		apiv1.ContinueAsNewInitiator_CONTINUE_AS_NEW_INITIATOR_RETRY_POLICY,
    80  		apiv1.ContinueAsNewInitiator_CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE,
    81  	} {
    82  		assert.Equal(t, item, proto.ContinueAsNewInitiator(thrift.ContinueAsNewInitiator(item)))
    83  	}
    84  	assert.Panics(t, func() { proto.ContinueAsNewInitiator(shared.ContinueAsNewInitiator(UnknownValue).Ptr()) })
    85  	assert.Panics(t, func() { thrift.ContinueAsNewInitiator(apiv1.ContinueAsNewInitiator(UnknownValue)) })
    86  }
    87  func TestDecisionTaskFailedCause(t *testing.T) {
    88  	for _, item := range []apiv1.DecisionTaskFailedCause{
    89  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_INVALID,
    90  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION,
    91  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,
    92  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,
    93  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES,
    94  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES,
    95  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES,
    96  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,
    97  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,
    98  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,
    99  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,
   100  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES,
   101  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID,
   102  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST,
   103  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE,
   104  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,
   105  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES,
   106  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION,
   107  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION,
   108  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE,
   109  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW,
   110  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_BINARY,
   111  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID,
   112  		apiv1.DecisionTaskFailedCause_DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES,
   113  	} {
   114  		assert.Equal(t, item, proto.DecisionTaskFailedCause(thrift.DecisionTaskFailedCause(item)))
   115  	}
   116  	assert.Panics(t, func() { proto.DecisionTaskFailedCause(shared.DecisionTaskFailedCause(UnknownValue).Ptr()) })
   117  	assert.Panics(t, func() { thrift.DecisionTaskFailedCause(apiv1.DecisionTaskFailedCause(UnknownValue)) })
   118  }
   119  func TestDomainStatus(t *testing.T) {
   120  	for _, item := range []apiv1.DomainStatus{
   121  		apiv1.DomainStatus_DOMAIN_STATUS_INVALID,
   122  		apiv1.DomainStatus_DOMAIN_STATUS_REGISTERED,
   123  		apiv1.DomainStatus_DOMAIN_STATUS_DEPRECATED,
   124  		apiv1.DomainStatus_DOMAIN_STATUS_DELETED,
   125  	} {
   126  		assert.Equal(t, item, proto.DomainStatus(thrift.DomainStatus(item)))
   127  	}
   128  	assert.Panics(t, func() { proto.DomainStatus(shared.DomainStatus(UnknownValue).Ptr()) })
   129  	assert.Panics(t, func() { thrift.DomainStatus(apiv1.DomainStatus(UnknownValue)) })
   130  }
   131  func TestEncodingType(t *testing.T) {
   132  	for _, item := range []apiv1.EncodingType{
   133  		apiv1.EncodingType_ENCODING_TYPE_INVALID,
   134  		apiv1.EncodingType_ENCODING_TYPE_THRIFTRW,
   135  		apiv1.EncodingType_ENCODING_TYPE_JSON,
   136  	} {
   137  		assert.Equal(t, item, proto.EncodingType(thrift.EncodingType(item)))
   138  	}
   139  	assert.Panics(t, func() { proto.EncodingType(shared.EncodingType(UnknownValue).Ptr()) })
   140  	assert.Panics(t, func() { thrift.EncodingType(apiv1.EncodingType(UnknownValue)) })
   141  	assert.Panics(t, func() { thrift.EncodingType(apiv1.EncodingType_ENCODING_TYPE_PROTO3) })
   142  }
   143  func TestEventFilterType(t *testing.T) {
   144  	for _, item := range []apiv1.EventFilterType{
   145  		apiv1.EventFilterType_EVENT_FILTER_TYPE_INVALID,
   146  		apiv1.EventFilterType_EVENT_FILTER_TYPE_ALL_EVENT,
   147  		apiv1.EventFilterType_EVENT_FILTER_TYPE_CLOSE_EVENT,
   148  	} {
   149  		assert.Equal(t, item, proto.EventFilterType(thrift.EventFilterType(item)))
   150  	}
   151  	assert.Panics(t, func() { proto.EventFilterType(shared.HistoryEventFilterType(UnknownValue).Ptr()) })
   152  	assert.Panics(t, func() { thrift.EventFilterType(apiv1.EventFilterType(UnknownValue)) })
   153  }
   154  func TestIndexedValueType(t *testing.T) {
   155  	for _, item := range []apiv1.IndexedValueType{
   156  		apiv1.IndexedValueType_INDEXED_VALUE_TYPE_STRING,
   157  		apiv1.IndexedValueType_INDEXED_VALUE_TYPE_KEYWORD,
   158  		apiv1.IndexedValueType_INDEXED_VALUE_TYPE_INT,
   159  		apiv1.IndexedValueType_INDEXED_VALUE_TYPE_DOUBLE,
   160  		apiv1.IndexedValueType_INDEXED_VALUE_TYPE_BOOL,
   161  		apiv1.IndexedValueType_INDEXED_VALUE_TYPE_DATETIME,
   162  	} {
   163  		assert.Equal(t, item, proto.IndexedValueType(thrift.IndexedValueType(item)))
   164  	}
   165  	assert.Panics(t, func() { thrift.IndexedValueType(apiv1.IndexedValueType_INDEXED_VALUE_TYPE_INVALID) })
   166  	assert.Panics(t, func() { proto.IndexedValueType(shared.IndexedValueType(UnknownValue)) })
   167  	assert.Panics(t, func() { thrift.IndexedValueType(apiv1.IndexedValueType(UnknownValue)) })
   168  }
   169  func TestParentClosePolicy(t *testing.T) {
   170  	for _, item := range []apiv1.ParentClosePolicy{
   171  		apiv1.ParentClosePolicy_PARENT_CLOSE_POLICY_INVALID,
   172  		apiv1.ParentClosePolicy_PARENT_CLOSE_POLICY_ABANDON,
   173  		apiv1.ParentClosePolicy_PARENT_CLOSE_POLICY_REQUEST_CANCEL,
   174  		apiv1.ParentClosePolicy_PARENT_CLOSE_POLICY_TERMINATE,
   175  	} {
   176  		assert.Equal(t, item, proto.ParentClosePolicy(thrift.ParentClosePolicy(item)))
   177  	}
   178  	assert.Panics(t, func() { proto.ParentClosePolicy(shared.ParentClosePolicy(UnknownValue).Ptr()) })
   179  	assert.Panics(t, func() { thrift.ParentClosePolicy(apiv1.ParentClosePolicy(UnknownValue)) })
   180  }
   181  func TestPendingActivityState(t *testing.T) {
   182  	for _, item := range []apiv1.PendingActivityState{
   183  		apiv1.PendingActivityState_PENDING_ACTIVITY_STATE_INVALID,
   184  		apiv1.PendingActivityState_PENDING_ACTIVITY_STATE_SCHEDULED,
   185  		apiv1.PendingActivityState_PENDING_ACTIVITY_STATE_STARTED,
   186  		apiv1.PendingActivityState_PENDING_ACTIVITY_STATE_CANCEL_REQUESTED,
   187  	} {
   188  		assert.Equal(t, item, proto.PendingActivityState(thrift.PendingActivityState(item)))
   189  	}
   190  	assert.Panics(t, func() { proto.PendingActivityState(shared.PendingActivityState(UnknownValue).Ptr()) })
   191  	assert.Panics(t, func() { thrift.PendingActivityState(apiv1.PendingActivityState(UnknownValue)) })
   192  }
   193  func TestPendingDecisionState(t *testing.T) {
   194  	for _, item := range []apiv1.PendingDecisionState{
   195  		apiv1.PendingDecisionState_PENDING_DECISION_STATE_INVALID,
   196  		apiv1.PendingDecisionState_PENDING_DECISION_STATE_SCHEDULED,
   197  		apiv1.PendingDecisionState_PENDING_DECISION_STATE_STARTED,
   198  	} {
   199  		assert.Equal(t, item, proto.PendingDecisionState(thrift.PendingDecisionState(item)))
   200  	}
   201  	assert.Panics(t, func() { proto.PendingDecisionState(shared.PendingDecisionState(UnknownValue).Ptr()) })
   202  	assert.Panics(t, func() { thrift.PendingDecisionState(apiv1.PendingDecisionState(UnknownValue)) })
   203  }
   204  func TestQueryConsistencyLevel(t *testing.T) {
   205  	for _, item := range []apiv1.QueryConsistencyLevel{
   206  		apiv1.QueryConsistencyLevel_QUERY_CONSISTENCY_LEVEL_INVALID,
   207  		apiv1.QueryConsistencyLevel_QUERY_CONSISTENCY_LEVEL_EVENTUAL,
   208  		apiv1.QueryConsistencyLevel_QUERY_CONSISTENCY_LEVEL_STRONG,
   209  	} {
   210  		assert.Equal(t, item, proto.QueryConsistencyLevel(thrift.QueryConsistencyLevel(item)))
   211  	}
   212  	assert.Panics(t, func() { proto.QueryConsistencyLevel(shared.QueryConsistencyLevel(UnknownValue).Ptr()) })
   213  	assert.Panics(t, func() { thrift.QueryConsistencyLevel(apiv1.QueryConsistencyLevel(UnknownValue)) })
   214  }
   215  func TestQueryRejectCondition(t *testing.T) {
   216  	for _, item := range []apiv1.QueryRejectCondition{
   217  		apiv1.QueryRejectCondition_QUERY_REJECT_CONDITION_INVALID,
   218  		apiv1.QueryRejectCondition_QUERY_REJECT_CONDITION_NOT_OPEN,
   219  		apiv1.QueryRejectCondition_QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY,
   220  	} {
   221  		assert.Equal(t, item, proto.QueryRejectCondition(thrift.QueryRejectCondition(item)))
   222  	}
   223  	assert.Panics(t, func() { proto.QueryRejectCondition(shared.QueryRejectCondition(UnknownValue).Ptr()) })
   224  	assert.Panics(t, func() { thrift.QueryRejectCondition(apiv1.QueryRejectCondition(UnknownValue)) })
   225  }
   226  func TestQueryResultType(t *testing.T) {
   227  	for _, item := range []apiv1.QueryResultType{
   228  		apiv1.QueryResultType_QUERY_RESULT_TYPE_INVALID,
   229  		apiv1.QueryResultType_QUERY_RESULT_TYPE_ANSWERED,
   230  		apiv1.QueryResultType_QUERY_RESULT_TYPE_FAILED,
   231  	} {
   232  		assert.Equal(t, item, proto.QueryResultType(thrift.QueryResultType(item)))
   233  	}
   234  	assert.Panics(t, func() { proto.QueryResultType(shared.QueryResultType(UnknownValue).Ptr()) })
   235  	assert.Panics(t, func() { thrift.QueryResultType(apiv1.QueryResultType(UnknownValue)) })
   236  }
   237  func TestQueryTaskCompletedType(t *testing.T) {
   238  	for _, item := range []apiv1.QueryResultType{
   239  		apiv1.QueryResultType_QUERY_RESULT_TYPE_INVALID,
   240  		apiv1.QueryResultType_QUERY_RESULT_TYPE_ANSWERED,
   241  		apiv1.QueryResultType_QUERY_RESULT_TYPE_FAILED,
   242  	} {
   243  		assert.Equal(t, item, proto.QueryTaskCompletedType(thrift.QueryTaskCompletedType(item)))
   244  	}
   245  	assert.Panics(t, func() { thrift.QueryTaskCompletedType(apiv1.QueryResultType(UnknownValue)) })
   246  	assert.Panics(t, func() { proto.QueryTaskCompletedType(shared.QueryTaskCompletedType(UnknownValue).Ptr()) })
   247  }
   248  func TestSignalExternalWorkflowExecutionFailedCause(t *testing.T) {
   249  	for _, item := range []apiv1.SignalExternalWorkflowExecutionFailedCause{
   250  		apiv1.SignalExternalWorkflowExecutionFailedCause_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID,
   251  		apiv1.SignalExternalWorkflowExecutionFailedCause_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,
   252  	} {
   253  		assert.Equal(t, item, proto.SignalExternalWorkflowExecutionFailedCause(thrift.SignalExternalWorkflowExecutionFailedCause(item)))
   254  	}
   255  	assert.Panics(t, func() {
   256  		proto.SignalExternalWorkflowExecutionFailedCause(shared.SignalExternalWorkflowExecutionFailedCause(UnknownValue).Ptr())
   257  	})
   258  	assert.Panics(t, func() {
   259  		thrift.SignalExternalWorkflowExecutionFailedCause(apiv1.SignalExternalWorkflowExecutionFailedCause(UnknownValue))
   260  	})
   261  }
   262  func TestTaskListKind(t *testing.T) {
   263  	for _, item := range []apiv1.TaskListKind{
   264  		apiv1.TaskListKind_TASK_LIST_KIND_INVALID,
   265  		apiv1.TaskListKind_TASK_LIST_KIND_NORMAL,
   266  		apiv1.TaskListKind_TASK_LIST_KIND_STICKY,
   267  	} {
   268  		assert.Equal(t, item, proto.TaskListKind(thrift.TaskListKind(item)))
   269  	}
   270  	assert.Panics(t, func() { proto.TaskListKind(shared.TaskListKind(UnknownValue).Ptr()) })
   271  	assert.Panics(t, func() { thrift.TaskListKind(apiv1.TaskListKind(UnknownValue)) })
   272  }
   273  func TestTaskListType(t *testing.T) {
   274  	for _, item := range []apiv1.TaskListType{
   275  		apiv1.TaskListType_TASK_LIST_TYPE_INVALID,
   276  		apiv1.TaskListType_TASK_LIST_TYPE_DECISION,
   277  		apiv1.TaskListType_TASK_LIST_TYPE_ACTIVITY,
   278  	} {
   279  		assert.Equal(t, item, proto.TaskListType(thrift.TaskListType(item)))
   280  	}
   281  	assert.Panics(t, func() { proto.TaskListType(shared.TaskListType(UnknownValue).Ptr()) })
   282  	assert.Panics(t, func() { thrift.TaskListType(apiv1.TaskListType(UnknownValue)) })
   283  }
   284  func TestTimeoutType(t *testing.T) {
   285  	for _, item := range []apiv1.TimeoutType{
   286  		apiv1.TimeoutType_TIMEOUT_TYPE_INVALID,
   287  		apiv1.TimeoutType_TIMEOUT_TYPE_START_TO_CLOSE,
   288  		apiv1.TimeoutType_TIMEOUT_TYPE_SCHEDULE_TO_START,
   289  		apiv1.TimeoutType_TIMEOUT_TYPE_SCHEDULE_TO_CLOSE,
   290  		apiv1.TimeoutType_TIMEOUT_TYPE_HEARTBEAT,
   291  	} {
   292  		assert.Equal(t, item, proto.TimeoutType(thrift.TimeoutType(item)))
   293  	}
   294  	assert.Panics(t, func() { proto.TimeoutType(shared.TimeoutType(UnknownValue).Ptr()) })
   295  	assert.Panics(t, func() { thrift.TimeoutType(apiv1.TimeoutType(UnknownValue)) })
   296  }
   297  func TestDecisionTaskTimedOutCause(t *testing.T) {
   298  	for _, item := range []apiv1.DecisionTaskTimedOutCause{
   299  		apiv1.DecisionTaskTimedOutCause_DECISION_TASK_TIMED_OUT_CAUSE_INVALID,
   300  		apiv1.DecisionTaskTimedOutCause_DECISION_TASK_TIMED_OUT_CAUSE_TIMEOUT,
   301  		apiv1.DecisionTaskTimedOutCause_DECISION_TASK_TIMED_OUT_CAUSE_RESET,
   302  	} {
   303  		assert.Equal(t, item, proto.DecisionTaskTimedOutCause(thrift.DecisionTaskTimedOutCause(item)))
   304  	}
   305  	assert.Panics(t, func() { proto.DecisionTaskTimedOutCause(shared.DecisionTaskTimedOutCause(UnknownValue).Ptr()) })
   306  	assert.Panics(t, func() { thrift.DecisionTaskTimedOutCause(apiv1.DecisionTaskTimedOutCause(UnknownValue)) })
   307  }
   308  func TestWorkflowExecutionCloseStatus(t *testing.T) {
   309  	for _, item := range []apiv1.WorkflowExecutionCloseStatus{
   310  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID,
   311  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED,
   312  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_FAILED,
   313  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_CANCELED,
   314  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_TERMINATED,
   315  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_CONTINUED_AS_NEW,
   316  		apiv1.WorkflowExecutionCloseStatus_WORKFLOW_EXECUTION_CLOSE_STATUS_TIMED_OUT,
   317  	} {
   318  		assert.Equal(t, item, proto.WorkflowExecutionCloseStatus(thrift.WorkflowExecutionCloseStatus(item)))
   319  	}
   320  	assert.Panics(t, func() { proto.WorkflowExecutionCloseStatus(shared.WorkflowExecutionCloseStatus(UnknownValue).Ptr()) })
   321  	assert.Panics(t, func() { thrift.WorkflowExecutionCloseStatus(apiv1.WorkflowExecutionCloseStatus(UnknownValue)) })
   322  }
   323  func TestWorkflowIDReusePolicy(t *testing.T) {
   324  	for _, item := range []apiv1.WorkflowIdReusePolicy{
   325  		apiv1.WorkflowIdReusePolicy_WORKFLOW_ID_REUSE_POLICY_INVALID,
   326  		apiv1.WorkflowIdReusePolicy_WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY,
   327  		apiv1.WorkflowIdReusePolicy_WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE,
   328  		apiv1.WorkflowIdReusePolicy_WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE,
   329  		apiv1.WorkflowIdReusePolicy_WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING,
   330  	} {
   331  		assert.Equal(t, item, proto.WorkflowIdReusePolicy(thrift.WorkflowIdReusePolicy(item)))
   332  	}
   333  	assert.Panics(t, func() { proto.WorkflowIdReusePolicy(shared.WorkflowIdReusePolicy(UnknownValue).Ptr()) })
   334  	assert.Panics(t, func() { thrift.WorkflowIdReusePolicy(apiv1.WorkflowIdReusePolicy(UnknownValue)) })
   335  }