Documentation
¶
Overview ¶
Package helper (imported as testautocore_helper) provides low-level SQL assertions and mutations used by autocore tests. It deliberately imports nothing from internal/autocore or internal/autocore/persistence so it can be used from the in-package (package autocore / package persistence) tests without creating an import cycle. IDs, shard ids and states are therefore accepted as generic types constrained to their underlying kinds via the named constraints in constraints.go, so callers can pass real typed values without a cast.
Index ¶
- func ActivityTaskExists[S shardID, W workflowID, A activityTaskID](tb testing.TB, db DB, shardID S, workflowID W, activityTaskID A) bool
- func ActivityTaskState[S shardID, A activityTaskID](tb testing.TB, db DB, shardID S, activityTaskID A) int16
- func BackdateScheduledTasks[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W)
- func BackdateWorkflowUpdatedAt[W workflowID](tb testing.TB, db DB, workflowID W, at time.Time)
- func BumpShardFence[S shardID](tb testing.TB, db DB, shardID S)
- func CountActivityTasks[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int
- func CountActivityTasksInState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, state St) int
- func CountHistoryEvents[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int
- func CountScheduledTasks[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int
- func CountSignals[W workflowID](tb testing.TB, db DB, workflowID W) int
- func CountWorkflowExecutions[W workflowID](tb testing.TB, db DB, workflowID W) int
- func CountWorkflowTasks[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int
- func CountWorkflowTasksInState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, state St) int
- func ExpireShardLease[S shardID](tb testing.TB, db DB, shardID S)
- func PartitionAttached(tb testing.TB, db DB, relname string) bool
- func RequireActivityTaskState[S shardID, A activityTaskID, St state](tb testing.TB, db DB, shardID S, activityTaskID A, want St)
- func RequireExecutionState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, want St)
- func RequireExecutionStateEventually[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, want St)
- func RequireWorkflowTaskState[S shardID, W workflowID, T workflowTaskID, St state](tb testing.TB, db DB, shardID S, workflowID W, workflowTaskID T, want St)
- func SetShardLeaseState[S shardID, St state](tb testing.TB, db DB, shardID S, state St)
- func SetWorkflowExecutionState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, state St)
- func TableExists(tb testing.TB, db DB, relname string) bool
- func WorkflowExecutionState[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int16
- func WorkflowTaskExists[S shardID, W workflowID, T workflowTaskID](tb testing.TB, db DB, shardID S, workflowID W, workflowTaskID T) bool
- func WorkflowTaskState[S shardID, W workflowID, T workflowTaskID](tb testing.TB, db DB, shardID S, workflowID W, workflowTaskID T) int16
- type DB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityTaskExists ¶
func ActivityTaskExists[S shardID, W workflowID, A activityTaskID](tb testing.TB, db DB, shardID S, workflowID W, activityTaskID A) bool
ActivityTaskExists reports whether an activity_task row exists for the given shard, workflow and activity task id.
func ActivityTaskState ¶
func ActivityTaskState[S shardID, A activityTaskID](tb testing.TB, db DB, shardID S, activityTaskID A) int16
ActivityTaskState returns the activity_task_state of the activity task addressed by shard and activity task id.
func BackdateScheduledTasks ¶
BackdateScheduledTasks moves every scheduled_task for the workflow into the past so its due timers fire on the next scan.
func BackdateWorkflowUpdatedAt ¶
BackdateWorkflowUpdatedAt sets the workflow's updated_at to at, used to age a workflow past a retirement/drain window. Callers pass an absolute time, e.g. time.Now().Add(-120 * 24 * time.Hour).
func BumpShardFence ¶
BumpShardFence increments the shard's fence_id, simulating another instance having re-claimed it.
func CountActivityTasks ¶
CountActivityTasks returns the number of activity_task rows for the workflow.
func CountActivityTasksInState ¶
func CountActivityTasksInState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, state St) int
CountActivityTasksInState returns the number of activity_task rows for the workflow in the given state.
func CountHistoryEvents ¶
CountHistoryEvents returns the number of history_event rows for the workflow.
func CountScheduledTasks ¶
func CountScheduledTasks[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int
CountScheduledTasks returns the number of scheduled_task rows for the workflow.
func CountSignals ¶
CountSignals returns the number of signal_inbox rows for the workflow.
func CountWorkflowExecutions ¶
CountWorkflowExecutions returns the number of workflow_execution rows with the given workflow id (across all shards).
func CountWorkflowTasks ¶
CountWorkflowTasks returns the number of workflow_task rows for the workflow.
func CountWorkflowTasksInState ¶
func CountWorkflowTasksInState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, state St) int
CountWorkflowTasksInState returns the number of workflow_task rows for the workflow in the given state.
func ExpireShardLease ¶
ExpireShardLease backdates the shard's lease expiry to the epoch, simulating a timed-out lease.
func PartitionAttached ¶
PartitionAttached reports whether the named relation is currently attached as a partition to a parent table.
func RequireActivityTaskState ¶
func RequireActivityTaskState[S shardID, A activityTaskID, St state](tb testing.TB, db DB, shardID S, activityTaskID A, want St)
RequireActivityTaskState asserts the activity task is in the given state.
func RequireExecutionState ¶
func RequireExecutionState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, want St)
RequireExecutionState asserts the workflow is currently in the given state.
func RequireExecutionStateEventually ¶
func RequireExecutionStateEventually[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, want St)
RequireExecutionStateEventually polls until the workflow reaches the given state, treating a missing row as "not created yet".
func RequireWorkflowTaskState ¶
func RequireWorkflowTaskState[S shardID, W workflowID, T workflowTaskID, St state](tb testing.TB, db DB, shardID S, workflowID W, workflowTaskID T, want St)
RequireWorkflowTaskState asserts the workflow task is in the given state.
func SetShardLeaseState ¶
SetShardLeaseState sets the shard's lifecycle state.
func SetWorkflowExecutionState ¶
func SetWorkflowExecutionState[S shardID, W workflowID, St state](tb testing.TB, db DB, shardID S, workflowID W, state St)
SetWorkflowExecutionState forces the workflow into the given execution state.
func TableExists ¶
TableExists reports whether a relation with the given name exists, whether or not it is currently attached as a partition.
func WorkflowExecutionState ¶
func WorkflowExecutionState[S shardID, W workflowID](tb testing.TB, db DB, shardID S, workflowID W) int16
WorkflowExecutionState returns the current workflow_execution_state of the workflow. Fails the test if no row exists.