Skip to content

Nexus chasm invocation task unit tests#9880

Merged
bergundy merged 7 commits intotemporalio:nexus/hsm-to-chasm-migrationfrom
bergundy:nexus-chasm-invocation-task-unit-tests
Apr 10, 2026
Merged

Nexus chasm invocation task unit tests#9880
bergundy merged 7 commits intotemporalio:nexus/hsm-to-chasm-migrationfrom
bergundy:nexus-chasm-invocation-task-unit-tests

Conversation

@bergundy
Copy link
Copy Markdown
Member

@bergundy bergundy commented Apr 8, 2026

What changed?

Port the invocation executor tests from components/nexusoperations/executor_tests.go to CHASM.

Why?

Test coverage was missing previously.

@bergundy bergundy requested review from a team as code owners April 8, 2026 23:52
@bergundy bergundy force-pushed the nexus/hsm-to-chasm-migration branch from 7fbdb9f to 5be312b Compare April 9, 2026 05:28
@bergundy bergundy requested a review from a team as a code owner April 9, 2026 05:28
@bergundy bergundy force-pushed the nexus-chasm-invocation-task-unit-tests branch from 344dd29 to 7e84525 Compare April 9, 2026 05:32
@stephanos stephanos force-pushed the nexus/hsm-to-chasm-migration branch 2 times, most recently from 978ec33 to 12007cf Compare April 9, 2026 15:05
@bergundy bergundy force-pushed the nexus-chasm-invocation-task-unit-tests branch from 7e84525 to 55fefd3 Compare April 9, 2026 17:23
@bergundy bergundy force-pushed the nexus/hsm-to-chasm-migration branch from 12007cf to 6ae06cc Compare April 9, 2026 19:13
@bergundy bergundy force-pushed the nexus-chasm-invocation-task-unit-tests branch 2 times, most recently from f67e908 to e5a6e08 Compare April 9, 2026 20:23
@bergundy bergundy force-pushed the nexus/hsm-to-chasm-migration branch from 2138a0e to 3206e99 Compare April 9, 2026 20:49
@bergundy bergundy force-pushed the nexus-chasm-invocation-task-unit-tests branch from e5a6e08 to 9a70a1e Compare April 9, 2026 20:49
@bergundy bergundy force-pushed the nexus-chasm-invocation-task-unit-tests branch from 9a70a1e to a606551 Compare April 9, 2026 21:21
@stephanos stephanos self-requested a review April 9, 2026 21:57
expectedMetricOutcome: "invalid-operation-token",
checkOutcome: func(t *testing.T, op *Operation, err error) {
require.NoError(t, err)
require.Equal(t, nexusoperationpb.OPERATION_STATUS_FAILED, op.Status)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we assert that the error is non-retryable?

schedToStartTimeout time.Duration
destinationDown bool
endpointNotFound bool
noUpdateComponent bool // Set to true when the handler returns early without calling UpdateComponent.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this is never true?

require.NotNil(t, failure.Cause)
require.Equal(t, "cause", failure.Cause.Message)
require.NotNil(t, failure.Cause.GetApplicationFailureInfo())
require.Equal(t, "NexusFailure", failure.Cause.GetApplicationFailureInfo().GetType())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: would a single equal check on the full failure be easier to read (and write)? it's nice because it's exhaustive. It doesn't always work but it seems here it would.

{
name: "async start",
requestTimeout: time.Hour,
checkStartOperationOptions: func(t *testing.T, options nexus.StartOperationOptions) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: since this is the only use of this, could we fold these checks into onStartOperation and drop this field? I recognize that onStartOperation doesn't have testing.T, that could probably be added and still satisfy the nexustest AFAICT.

schedToCloseTimeout time.Duration
startToCloseTimeout time.Duration
schedToStartTimeout time.Duration
destinationDown bool
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see it being set to true but not used?

onStartOperation func(ctx context.Context, service, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error)
expectedMetricOutcome string
checkOutcome func(t *testing.T, op *Operation, err error)
requestTimeout time.Duration
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why always set this one but not the other timeouts? Could use cmp.Or(tc.requestTimeout, time.Hour)


var metricsHandler metrics.Handler
if tc.expectedMetricOutcome != "" {
mockMetrics := metrics.NewMockHandler(ctrl)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be metricstest.NewCaptureHandler() instead? Might be slightly simpler/shorter.

@bergundy bergundy merged commit d459b8a into temporalio:nexus/hsm-to-chasm-migration Apr 10, 2026
45 checks passed
bergundy added a commit that referenced this pull request Apr 10, 2026
bergundy added a commit that referenced this pull request Apr 10, 2026
## What changed?

Port the invocation executor tests from
`components/nexusoperations/executor_tests.go` to CHASM.

## Why?

Test coverage was missing previously.
bergundy added a commit that referenced this pull request Apr 10, 2026
stephanos pushed a commit that referenced this pull request Apr 13, 2026
Port the invocation executor tests from
`components/nexusoperations/executor_tests.go` to CHASM.

Test coverage was missing previously.
stephanos pushed a commit that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants